namespace PlotLine.Models; public static class StoryIntelligenceRunStatuses { public const string Pending = "Pending"; public const string Running = "Running"; public const string Completed = "Completed"; public const string CompletedWithWarnings = "CompletedWithWarnings"; public const string Failed = "Failed"; public const string Cancelled = "Cancelled"; } public static class StoryIntelligenceFailureStages { public const string DocumentRead = "DocumentRead"; public const string ChapterStructure = "ChapterStructure"; public const string SceneSplit = "SceneSplit"; public const string SceneIntelligence = "SceneIntelligence"; public const string Validation = "Validation"; public const string Persistence = "Persistence"; public const string DomainImport = "DomainImport"; } public sealed class StoryIntelligenceRunSaveRequest { public int UserID { get; init; } public int? ProjectID { get; init; } public int? BookID { get; init; } public string Status { get; init; } = StoryIntelligenceRunStatuses.Completed; public string SourceType { get; init; } = "AdminDryRun"; public string? SourceFileName { get; init; } public long? SourceFileSizeBytes { get; init; } public int? SourceWordCount { get; init; } public int? SourceCharacterCount { get; init; } public int? SourceParagraphCount { get; init; } public int? SourceChapterCount { get; init; } public int? SourceDetectedImagesCount { get; init; } public int? SourceDetectedTablesCount { get; init; } public int? SourceDetectedFootnotesCount { get; init; } public int? SourceDetectedCommentsCount { get; init; } public string PromptVersion { get; init; } = string.Empty; public string Model { get; init; } = string.Empty; public DateTime StartedUtc { get; init; } public DateTime? CompletedUtc { get; init; } public string? FailureStage { get; init; } public int? TotalInputTokens { get; init; } public int? TotalOutputTokens { get; init; } public int? TotalTokens { get; init; } public long? TotalDurationMs { get; init; } public decimal? EstimatedCostGBP { get; init; } public decimal? EstimatedCostUSD { get; init; } public string? PromptVersionsSummary { get; init; } public string? ErrorMessage { get; init; } public string? ErrorDetail { get; init; } public StoryIntelligenceChapterResultSaveRequest? ChapterResult { get; init; } public IReadOnlyList SceneResults { get; init; } = []; } public sealed class StoryIntelligenceRunQueueRequest { public int UserID { get; init; } public int? ProjectID { get; init; } public int? BookID { get; init; } public int? ChapterID { get; init; } public decimal? ChapterNumber { get; init; } public string SourceType { get; init; } = "AdminText"; public string SourceLabel { get; init; } = string.Empty; public string ChapterText { get; init; } = string.Empty; public string? SourceFileName { get; init; } public long? SourceFileSizeBytes { get; init; } public int? SourceWordCount { get; init; } public int? SourceCharacterCount { get; init; } public int? SourceParagraphCount { get; init; } public int? SourceChapterCount { get; init; } public string Model { get; init; } = string.Empty; public string PromptVersionsSummary { get; init; } = string.Empty; } public sealed class StoryIntelligenceChapterResultSaveRequest { public int? ProjectID { get; init; } public int? BookID { get; init; } public int? ChapterID { get; init; } public decimal? ChapterNumber { get; init; } public string SourceLabel { get; init; } = string.Empty; public string PromptVersion { get; init; } = string.Empty; public string Model { get; init; } = string.Empty; public string RawResponseJson { get; init; } = string.Empty; public string OutputTextJson { get; init; } = string.Empty; public string ParsedJson { get; init; } = string.Empty; public int ValidationErrorsCount { get; init; } public int ValidationWarningsCount { get; init; } public int? InputTokens { get; init; } public int? OutputTokens { get; init; } public int? TotalTokens { get; init; } public long? DurationMs { get; init; } } public sealed class StoryIntelligenceSceneResultSaveRequest { public int? ProjectID { get; init; } public int? BookID { get; init; } public int? ChapterID { get; init; } public int? SceneID { get; init; } public int TemporarySceneNumber { get; init; } public int? StartParagraph { get; init; } public int? EndParagraph { get; init; } public string SourceLabel { get; init; } = string.Empty; public string PromptVersion { get; init; } = string.Empty; public string Model { get; init; } = string.Empty; public string RawResponseJson { get; init; } = string.Empty; public string OutputTextJson { get; init; } = string.Empty; public string ParsedJson { get; init; } = string.Empty; public int ValidationErrorsCount { get; init; } public int ValidationWarningsCount { get; init; } public int? InputTokens { get; init; } public int? OutputTokens { get; init; } public int? TotalTokens { get; init; } public long? DurationMs { get; init; } } public sealed class StoryIntelligenceSavedRunListItem { public int StoryIntelligenceRunID { get; init; } public DateTime CreatedUtc { get; init; } public int UserID { get; init; } public int? ProjectID { get; init; } public string? ProjectTitle { get; init; } public int? BookID { get; init; } public string? BookTitle { get; init; } public int? ChapterID { get; init; } public decimal? ChapterNumber { get; init; } public string Status { get; init; } = string.Empty; public string SourceType { get; init; } = string.Empty; public string? FailureStage { get; init; } public int SceneCount { get; init; } public int? TotalTokens { get; init; } public long? TotalDurationMs { get; init; } public decimal? EstimatedCostGBP { get; init; } public decimal? EstimatedCostUSD { get; init; } public int ValidationErrorsCount { get; init; } public int ValidationWarningsCount { get; init; } } public sealed class StoryIntelligenceSavedRun { public int StoryIntelligenceRunID { get; init; } public int UserID { get; init; } public int? ProjectID { get; init; } public string? ProjectTitle { get; init; } public int? BookID { get; init; } public string? BookTitle { get; init; } public int? ChapterID { get; init; } public decimal? ChapterNumber { get; init; } public string Status { get; init; } = string.Empty; public string SourceType { get; init; } = string.Empty; public string? SourceText { get; init; } public string? SourceFileName { get; init; } public long? SourceFileSizeBytes { get; init; } public int? SourceWordCount { get; init; } public int? SourceCharacterCount { get; init; } public int? SourceParagraphCount { get; init; } public int? SourceChapterCount { get; init; } public int? SourceDetectedImagesCount { get; init; } public int? SourceDetectedTablesCount { get; init; } public int? SourceDetectedFootnotesCount { get; init; } public int? SourceDetectedCommentsCount { get; init; } public string? CurrentStage { get; init; } public string? CurrentMessage { get; init; } public int? TotalDetectedScenes { get; init; } public int? CompletedScenes { get; init; } public int? FailedScenes { get; init; } public DateTime? CancellationRequestedUtc { get; init; } public DateTime? CancelledUtc { get; init; } public string PromptVersion { get; init; } = string.Empty; public string? PromptVersionsSummary { get; init; } public string Model { get; init; } = string.Empty; public DateTime StartedUtc { get; init; } public DateTime? CompletedUtc { get; init; } public string? FailureStage { get; init; } public int? TotalInputTokens { get; init; } public int? TotalOutputTokens { get; init; } public int? TotalTokens { get; init; } public long? TotalDurationMs { get; init; } public decimal? EstimatedCostGBP { get; init; } public decimal? EstimatedCostUSD { get; init; } public string? ErrorMessage { get; init; } public string? ErrorDetail { get; init; } public DateTime CreatedUtc { get; init; } public DateTime UpdatedUtc { get; init; } } public sealed class StoryIntelligenceQueuedRun { public int StoryIntelligenceRunID { get; init; } public int UserID { get; init; } public int? ProjectID { get; init; } public int? BookID { get; init; } public int? ChapterID { get; init; } public decimal? ChapterNumber { get; init; } public string Status { get; init; } = string.Empty; public string SourceType { get; init; } = string.Empty; public string? SourceLabel { get; init; } public string? SourceText { get; init; } public int? SourceWordCount { get; init; } public int? SourceCharacterCount { get; init; } public int? SourceParagraphCount { get; init; } public int? SourceChapterCount { get; init; } public string PromptVersion { get; init; } = string.Empty; public string? PromptVersionsSummary { get; init; } public string Model { get; init; } = string.Empty; public DateTime StartedUtc { get; init; } public DateTime? CompletedUtc { get; init; } public string? FailureStage { get; init; } public int? TotalInputTokens { get; init; } public int? TotalOutputTokens { get; init; } public int? TotalTokens { get; init; } public long? TotalDurationMs { get; init; } public decimal? EstimatedCostGBP { get; init; } public decimal? EstimatedCostUSD { get; init; } public string? ErrorMessage { get; init; } public string? ErrorDetail { get; init; } public string? CurrentStage { get; init; } public string? CurrentMessage { get; init; } public int? TotalDetectedScenes { get; init; } public int? CompletedScenes { get; init; } public int? FailedScenes { get; init; } public DateTime? CancellationRequestedUtc { get; init; } public DateTime? CancelledUtc { get; init; } public DateTime CreatedUtc { get; init; } public DateTime UpdatedUtc { get; init; } public bool CancellationRequested => CancellationRequestedUtc.HasValue; } public sealed class StoryIntelligenceSourceOption { public int Value { get; init; } public string Text { get; init; } = string.Empty; } public sealed class StoryIntelligenceExistingChapterSource { public int ProjectID { get; init; } public string ProjectName { get; init; } = string.Empty; public int BookID { get; init; } public string BookTitle { get; init; } = string.Empty; public string? BookSubtitle { get; init; } public int ChapterID { get; init; } public decimal ChapterNumber { get; init; } public string ChapterTitle { get; init; } = string.Empty; public string? SourceText { get; init; } public int? SourceWordCount { get; init; } public int? SourceCharacterCount { get; init; } public bool HasSourceText => !string.IsNullOrWhiteSpace(SourceText); } public sealed class StoryIntelligenceExistingChapterQueueForm { public int? ProjectID { get; init; } public int? BookID { get; init; } public int? ChapterID { get; init; } } public sealed class StoryIntelligenceExistingChapterQueueViewModel { public StoryIntelligenceExistingChapterQueueForm Form { get; init; } = new(); public IReadOnlyList Projects { get; init; } = []; public IReadOnlyList Books { get; init; } = []; public IReadOnlyList Chapters { get; init; } = []; public StoryIntelligenceExistingChapterSource? SelectedChapter { get; init; } public string? WarningMessage { get; init; } public string? ErrorMessage { get; init; } public int? QueuedRunID { get; init; } } public sealed class StoryIntelligenceFullChapterTestForm { public string? SourceLabel { get; init; } public int? ProjectID { get; init; } public int? BookID { get; init; } public int? ChapterID { get; init; } public string? ChapterStructureModel { get; init; } public string? SceneIntelligenceModel { get; init; } public string? ChapterText { get; init; } } public sealed class StoryIntelligenceFullChapterPreflight { public int CharacterCount { get; init; } public int WordCount { get; init; } public int ParagraphCount { get; init; } public int EstimatedInputTokens { get; init; } public int EstimatedPipelineInputTokens { get; init; } public decimal? EstimatedInputCostUSD { get; init; } public decimal? EstimatedInputCostGBP { get; init; } public IReadOnlyList Warnings { get; init; } = []; } public sealed class StoryIntelligenceFullChapterTestViewModel { public StoryIntelligenceFullChapterTestForm Form { get; init; } = new(); public IReadOnlyList ModelOptions { get; init; } = []; public StoryIntelligenceFullChapterPreflight? Preflight { get; init; } public string? SourceFileName { get; init; } public long? SourceFileSizeBytes { get; init; } public string? ErrorMessage { get; init; } } public sealed class StoryIntelligenceSavedChapterResult { public int ChapterResultID { get; init; } public int StoryIntelligenceRunID { get; init; } public int? ProjectID { get; init; } public int? BookID { get; init; } public int? ChapterID { get; init; } public decimal? ChapterNumber { get; init; } public string SourceLabel { get; init; } = string.Empty; public string PromptVersion { get; init; } = string.Empty; public string Model { get; init; } = string.Empty; public string RawResponseJson { get; init; } = string.Empty; public string OutputTextJson { get; init; } = string.Empty; public string ParsedJson { get; init; } = string.Empty; public int ValidationErrorsCount { get; init; } public int ValidationWarningsCount { get; init; } public int? InputTokens { get; init; } public int? OutputTokens { get; init; } public int? TotalTokens { get; init; } public long? DurationMs { get; init; } public DateTime CreatedUtc { get; init; } } public sealed class StoryIntelligenceSavedSceneResult { public int SceneResultID { get; init; } public int StoryIntelligenceRunID { get; init; } public int? ChapterResultID { get; init; } public int? ProjectID { get; init; } public int? BookID { get; init; } public int? ChapterID { get; init; } public int? SceneID { get; init; } public int TemporarySceneNumber { get; init; } public int? StartParagraph { get; init; } public int? EndParagraph { get; init; } public string SourceLabel { get; init; } = string.Empty; public string PromptVersion { get; init; } = string.Empty; public string Model { get; init; } = string.Empty; public string RawResponseJson { get; init; } = string.Empty; public string OutputTextJson { get; init; } = string.Empty; public string ParsedJson { get; init; } = string.Empty; public int ValidationErrorsCount { get; init; } public int ValidationWarningsCount { get; init; } public int? InputTokens { get; init; } public int? OutputTokens { get; init; } public int? TotalTokens { get; init; } public long? DurationMs { get; init; } public DateTime CreatedUtc { get; init; } }