namespace PlotLine.Models; public sealed class ProjectBackupExport { public string Format { get; init; } = "PlotDirector.ProjectBackup"; public string FormatVersion { get; init; } = "1.3"; public DateTime ExportedAtUtc { get; init; } public string SourceApplication { get; init; } = "PlotDirector"; public Project? Project { get; init; } public ProjectBackupData Data { get; init; } = new(); public IReadOnlyList Files { get; set; } = []; public ProjectBackupDiagnostics Diagnostics { get; init; } = new(); } public sealed class ProjectBackupData { public IReadOnlyList WholeBookPlotSynthesisRuns { get; set; } = []; public IReadOnlyList StoryIntelligenceNarrativeCandidates { get; set; } = []; public IReadOnlyList StoryIntelligenceNarrativeCandidateEvidence { get; set; } = []; public IReadOnlyList StoryIntelligenceNarrativeCandidateEvents { get; set; } = []; public IReadOnlyList CharacterEnrichmentRuns { get; set; } = []; public IReadOnlyList CharacterEnrichmentEvidence { get; set; } = []; public IReadOnlyList StoryIntelligenceReviewCandidateGenerations { get; set; } = []; public IReadOnlyList StoryIntelligenceReviewCandidates { get; set; } = []; public IReadOnlyList StoryIntelligenceReviewCandidateEvidence { get; set; } = []; public IReadOnlyList StoryIntelligenceBookPipelines { get; set; } = []; public IReadOnlyList StoryMemoryCharacters { get; set; } = []; public IReadOnlyList StoryMemoryCharacterAliases { get; set; } = []; public IReadOnlyList StoryMemoryCharacterAttributes { get; set; } = []; public IReadOnlyList StoryMemoryLocations { get; set; } = []; public IReadOnlyList StoryMemoryAssets { get; set; } = []; public IReadOnlyList StoryMemoryRelationships { get; set; } = []; public IReadOnlyList StoryMemoryProcessedSceneResults { get; set; } = []; public IReadOnlyList StoryMemoryImportPreferences { get; set; } = []; public IReadOnlyList CharacterIntelligenceProfiles { get; set; } = []; public IReadOnlyList CharacterIntelligenceEvidenceEvents { get; set; } = []; public IReadOnlyList StoryIntelligenceRuns { get; set; } = []; public IReadOnlyList StoryIntelligenceChapterResults { get; set; } = []; public IReadOnlyList StoryIntelligenceSceneResults { get; set; } = []; public IReadOnlyList StoryIntelligenceImportCommits { get; set; } = []; public IReadOnlyList CoreImportBasicLocationReviews { get; set; } = []; public IReadOnlyList CoreImportBasicLocationCandidates { get; set; } = []; public IReadOnlyList CoreImportBasicLocationEvidence { get; set; } = []; public IReadOnlyList SceneAssetSuggestions { get; set; } = []; public IReadOnlyList SceneCharacterSuggestions { get; set; } = []; public IReadOnlyList SceneLocationSuggestions { get; set; } = []; public IReadOnlyList SceneTextStatistics { get; set; } = []; public IReadOnlyList OnboardingManuscriptBuilds { get; set; } = []; public IReadOnlyList OnboardingManuscriptBuildChapterMap { get; set; } = []; public IReadOnlyList OnboardingManuscriptBuildSceneMap { get; set; } = []; public IReadOnlyList OnboardingManuscriptBuildCharacterMap { get; set; } = []; public IReadOnlyList CharacterImages { get; set; } = []; public IReadOnlyList WordCompanionSceneAssets { get; set; } = []; public IReadOnlyList WordCompanionSceneLocations { get; set; } = []; public IReadOnlyList ManuscriptDocuments { get; set; } = []; public IReadOnlyList SceneManuscriptSources { get; set; } = []; public IReadOnlyList ManuscriptStructuralChapterSources { get; set; } = []; public IReadOnlyList WritingPlans { get; set; } = []; public IReadOnlyList WritingScheduleItems { get; set; } = []; public IReadOnlyList CharacterAliases { get; set; } = []; public IReadOnlyList AssetAliases { get; set; } = []; public IReadOnlyList LocationAliases { get; set; } = []; public IReadOnlyList AuthorPlotSeeds { get; set; } = []; public IReadOnlyList ContinuityWarningAcknowledgements { get; set; } = []; public IReadOnlyList PlotEventTargetPlotLines { get; set; } = []; public IReadOnlyList MapReferenceImages { get; set; } = []; public IReadOnlyList MapJourneyNotes { get; set; } = []; public IReadOnlyList StoryMaps { get; set; } = []; public IReadOnlyList MapFeatures { get; set; } = []; public IReadOnlyList MapRelationships { get; set; } = []; public IReadOnlyList Books { get; init; } = []; public IReadOnlyList Chapters { get; init; } = []; public IReadOnlyList Scenes { get; init; } = []; public IReadOnlyList ScenePurposes { get; init; } = []; public IReadOnlyList SceneOutcomes { get; init; } = []; public IReadOnlyList SceneMetricTypes { get; init; } = []; public IReadOnlyList SceneMetricValues { get; init; } = []; public IReadOnlyList TimelineSettings { get; init; } = []; public IReadOnlyList TimelineMetricSettings { get; init; } = []; public IReadOnlyList TimelineViewPresets { get; init; } = []; public IReadOnlyList PlotLines { get; init; } = []; public IReadOnlyList PlotThreads { get; init; } = []; public IReadOnlyList ThreadEvents { get; init; } = []; public IReadOnlyList StoryAssets { get; init; } = []; public IReadOnlyList AssetStates { get; init; } = []; public IReadOnlyList AssetEvents { get; init; } = []; public IReadOnlyList AssetDependencies { get; init; } = []; public IReadOnlyList AssetCustodyEvents { get; init; } = []; public IReadOnlyList AssetCustodyCharacters { get; init; } = []; public IReadOnlyList Characters { get; init; } = []; public IReadOnlyList SceneCharacters { get; init; } = []; public IReadOnlyList CharacterAttributeTypes { get; init; } = []; public IReadOnlyList CharacterAttributeEvents { get; init; } = []; public IReadOnlyList CharacterKnowledge { get; init; } = []; public IReadOnlyList CharacterRelationships { get; init; } = []; public IReadOnlyList RelationshipEvents { get; init; } = []; public IReadOnlyList Locations { get; init; } = []; public IReadOnlyList LocationRelationships { get; init; } = []; public IReadOnlyList FloorPlans { get; init; } = []; public IReadOnlyList FloorPlanFloors { get; init; } = []; public IReadOnlyList FloorPlanBlocks { get; init; } = []; public IReadOnlyList FloorPlanTransitions { get; init; } = []; public IReadOnlyList SceneAssetLocations { get; init; } = []; public IReadOnlyList SceneFloorPlanOccupancy { get; init; } = []; public IReadOnlyList SceneDependencies { get; init; } = []; public IReadOnlyList ValidationRuns { get; init; } = []; public IReadOnlyList ContinuityWarnings { get; init; } = []; public IReadOnlyList SceneNotes { get; init; } = []; public IReadOnlyList SceneWorkflow { get; init; } = []; public IReadOnlyList SceneChecklistItems { get; init; } = []; public IReadOnlyList SceneAttachments { get; init; } = []; public IReadOnlyList ChapterGoals { get; init; } = []; public IReadOnlyList Scenarios { get; init; } = []; public IReadOnlyList ScenarioSceneOrder { get; init; } = []; public IReadOnlyList ScenarioValidationRuns { get; init; } = []; public IReadOnlyList ScenarioWarnings { get; init; } = []; public IReadOnlyList GenreMetricPresets { get; init; } = []; public IReadOnlyList GenreMetricPresetMetrics { get; init; } = []; public IReadOnlyList ProjectAccess { get; init; } = []; public IReadOnlyList UserFiles { get; init; } = []; } public sealed class ProjectBackupDiagnostics { public int ProjectId { get; init; } public IReadOnlyList IncludedEntitySets { get; init; } = []; public string? Note { get; init; } } public sealed class ProjectBackupResult { public string FileName { get; init; } = string.Empty; public string ContentType { get; init; } = "application/json"; public string Json { get; init; } = string.Empty; } public sealed class ProjectBackupScenePurpose { public int SceneID { get; set; } public int ScenePurposeTypeID { get; set; } public string PurposeName { get; set; } = string.Empty; public int SortOrder { get; set; } } public sealed class ProjectBackupSceneOutcome { public int SceneOutcomeID { get; set; } public int SceneID { get; set; } public string OutcomeDescription { get; set; } = string.Empty; public int? OutcomeTypeID { get; set; } public DateTime CreatedDate { get; set; } public DateTime UpdatedDate { get; set; } } public sealed class ProjectBackupAssetCustodyCharacter { public int AssetCustodyEventCharacterID { get; set; } public int AssetCustodyEventID { get; set; } public int? CharacterID { get; set; } public string? CharacterName { get; set; } public string? CharacterNameText { get; set; } public int CustodyRoleID { get; set; } public string CustodyRoleName { get; set; } = string.Empty; } public sealed class ProjectBackupValidationRun { public int ValidationRunID { get; set; } public int ProjectID { get; set; } public int? BookID { get; set; } public DateTime StartedDate { get; set; } public DateTime? CompletedDate { get; set; } public string? TriggeredBy { get; set; } public string? ScopeDescription { get; set; } } public sealed class ProjectBackupScenarioSceneOrder { public int ScenarioSceneOrderID { get; set; } public int ScenarioID { get; set; } public int SceneID { get; set; } public int? ProposedChapterID { get; set; } public int ProposedSortOrder { get; set; } public string? Notes { get; set; } public DateTime CreatedDate { get; set; } public DateTime UpdatedDate { get; set; } } public sealed class ProjectBackupScenarioValidationRun { public int ScenarioValidationRunID { get; set; } public int ScenarioID { get; set; } public DateTime StartedDate { get; set; } public DateTime? CompletedDate { get; set; } public int WarningCount { get; set; } } public sealed class ProjectBackupGenreMetricPresetMetric { public int GenreMetricPresetID { get; set; } public string PresetKey { get; set; } = string.Empty; public string PresetName { get; set; } = string.Empty; public int MetricTypeID { get; set; } public string MetricName { get; set; } = string.Empty; public int SortOrder { get; set; } } public sealed class ProjectBackupAccessRecord { public int ProjectUserAccessID { get; set; } public int ProjectID { get; set; } public int UserID { get; set; } public string Email { get; set; } = string.Empty; public string DisplayName { get; set; } = string.Empty; public string AccessRole { get; set; } = string.Empty; public int? InvitedByUserID { get; set; } public string? InvitedByEmail { get; set; } public DateTime? InvitedDateUTC { get; set; } public DateTime? AcceptedDateUTC { get; set; } public bool IsActive { get; set; } } public sealed class ProjectBackupSceneManuscriptSource { public int SceneID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public int ChapterID { get; set; } public string SourceText { get; set; } = string.Empty; public int SourceWordCount { get; set; } public int SourceCharacterCount { get; set; } public int? SourceStartParagraph { get; set; } public int? SourceEndParagraph { get; set; } public int? WordStartParagraphIndex { get; set; } public int? WordEndParagraphIndex { get; set; } public string SourceKind { get; set; } = string.Empty; public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } } public sealed class ProjectBackupStructuralChapterSource { public int ChapterID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public string SourceText { get; set; } = string.Empty; public int SourceWordCount { get; set; } public int SourceCharacterCount { get; set; } public string? ParagraphMapJson { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } public string? StructuralParsedJson { get; set; } public string? DefaultPovName { get; set; } public string? ExplicitNarratorName { get; set; } } public sealed class ProjectBackupPlotEventTarget { public int PlotEventID { get; set; } public int PlotLineID { get; set; } public DateTime CreatedDate { get; set; } } public sealed class ProjectBackupCompanionSceneAsset { public int WordCompanionSceneAssetID { get; set; } public int SceneID { get; set; } public int StoryAssetID { get; set; } public DateTime CreatedDate { get; set; } public DateTime UpdatedDate { get; set; } } public sealed class ProjectBackupCompanionSceneLocation { public int WordCompanionSceneLocationID { get; set; } public int SceneID { get; set; } public int LocationID { get; set; } public DateTime CreatedDate { get; set; } public DateTime UpdatedDate { get; set; } } public sealed class ProjectBackupFile { public string Path { get; set; } = string.Empty; public byte[] Data { get; set; } = []; public string Sha256 { get; set; } = string.Empty; public long FileSizeBytes => Data?.LongLength ?? 0; public string OriginalFileName => System.IO.Path.GetFileName(Path); public string? RestoredFileName => System.IO.Path.GetFileName(RestoredPath); public string ContentType => System.IO.Path.GetExtension(Path).ToLowerInvariant() switch { ".webp"=>"image/webp", ".png"=>"image/png", ".jpg" or ".jpeg"=>"image/jpeg", ".pdf"=>"application/pdf", ".txt"=>"text/plain", _=>"application/octet-stream" }; public string? RestoredPath { get; set; } public string? EntityType { get; set; } public int EntityID { get; set; } } public sealed class ProjectBackupOnboardingManuscriptBuilds { public int OnboardingManuscriptBuildID { get; set; } public Guid PreviewID { get; set; } public int UserID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public int? ManuscriptDocumentID { get; set; } public string Status { get; set; } = string.Empty; public string MarkerStatus { get; set; } = string.Empty; public int ChaptersCreated { get; set; } public int ScenesCreated { get; set; } public int CharactersCreated { get; set; } public int CharactersReused { get; set; } public int SceneAppearancesCreated { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } public string? MarkerSyncMessage { get; set; } public DateTime? MarkerSyncCompletedUtc { get; set; } } public sealed class ProjectBackupOnboardingManuscriptBuildChapterMap { public int OnboardingManuscriptBuildID { get; set; } public string TemporaryChapterKey { get; set; } = string.Empty; public int ChapterID { get; set; } } public sealed class ProjectBackupOnboardingManuscriptBuildSceneMap { public int OnboardingManuscriptBuildID { get; set; } public string TemporarySceneKey { get; set; } = string.Empty; public int SceneID { get; set; } } public sealed class ProjectBackupOnboardingManuscriptBuildCharacterMap { public int OnboardingManuscriptBuildID { get; set; } public string TemporaryCharacterKey { get; set; } = string.Empty; public int CharacterID { get; set; } public bool Created { get; set; } } public sealed class ProjectBackupSceneAssetSuggestions { public int SceneAssetSuggestionID { get; set; } public int SceneID { get; set; } public int AssetID { get; set; } public string SuggestionSource { get; set; } = ""; public DateTime DetectedUtc { get; set; } public string Status { get; set; } = ""; public string Confidence { get; set; } = ""; public string? Reason { get; set; } public int CreatedByUserID { get; set; } public int? ReviewedByUserID { get; set; } public DateTime? ReviewedUtc { get; set; } } public sealed class ProjectBackupSceneCharacterSuggestions { public int SceneCharacterSuggestionID { get; set; } public int SceneID { get; set; } public int CharacterID { get; set; } public string SuggestionSource { get; set; } = ""; public DateTime DetectedUtc { get; set; } public string Status { get; set; } = ""; public string Confidence { get; set; } = ""; public string? Reason { get; set; } public int CreatedByUserID { get; set; } public int? ReviewedByUserID { get; set; } public DateTime? ReviewedUtc { get; set; } } public sealed class ProjectBackupSceneLocationSuggestions { public int SceneLocationSuggestionID { get; set; } public int SceneID { get; set; } public int LocationID { get; set; } public string SuggestionSource { get; set; } = ""; public DateTime DetectedUtc { get; set; } public string Status { get; set; } = ""; public string Confidence { get; set; } = ""; public string? Reason { get; set; } public int CreatedByUserID { get; set; } public int? ReviewedByUserID { get; set; } public DateTime? ReviewedUtc { get; set; } } public sealed class ProjectBackupSceneTextStatistics { public int SceneID { get; set; } public int TotalWordCount { get; set; } public int DialogueWordCount { get; set; } public int ProseWordCount { get; set; } public int TotalParagraphCount { get; set; } public int DialogueParagraphCount { get; set; } public int ProseParagraphCount { get; set; } public DateTime CalculatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } } public sealed class ProjectBackupCoreImportBasicLocationReviews { public int CoreImportBasicLocationReviewID { get; set; } public Guid PreviewID { get; set; } public int UserID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public int? BuildID { get; set; } public string Status { get; set; } = ""; public int RawObservationCount { get; set; } public int CandidateCount { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } public DateTime? CompletedUtc { get; set; } } public sealed class ProjectBackupCoreImportBasicLocationCandidates { public int CoreImportBasicLocationCandidateID { get; set; } public int CoreImportBasicLocationReviewID { get; set; } public string StableKey { get; set; } = ""; public string ProposedName { get; set; } = ""; public string PreferredName { get; set; } = ""; public string KnownNamesJson { get; set; } = ""; public int? ParentLocationID { get; set; } public string? ParentCandidateKey { get; set; } public int? ExistingLocationID { get; set; } public string Action { get; set; } = ""; public int? SameAsLocationID { get; set; } public string? SameAsCandidateKey { get; set; } public int? ResultLocationID { get; set; } public int FirstChapterNumber { get; set; } public int FirstSceneNumber { get; set; } public int FirstOccurrenceIndex { get; set; } public int ObservationCount { get; set; } public int SortOrder { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } } public sealed class ProjectBackupCoreImportBasicLocationEvidence { public int CoreImportBasicLocationEvidenceID { get; set; } public int CoreImportBasicLocationCandidateID { get; set; } public int SceneID { get; set; } public int ChapterID { get; set; } public int ChapterNumber { get; set; } public int SceneNumber { get; set; } public int OccurrenceIndex { get; set; } public string EvidenceText { get; set; } = ""; public int SortOrder { get; set; } } public sealed class ProjectBackupStoryIntelligenceRuns { public int StoryIntelligenceRunID { get; set; } public int UserID { get; set; } public int? ProjectID { get; set; } public int? BookID { get; set; } public string Status { get; set; } = ""; public string SourceType { get; set; } = ""; public string PromptVersion { get; set; } = ""; public string Model { get; set; } = ""; public DateTime StartedUtc { get; set; } public DateTime? CompletedUtc { get; set; } public int? TotalInputTokens { get; set; } public int? TotalOutputTokens { get; set; } public int? TotalTokens { get; set; } public long? TotalDurationMs { get; set; } public string? ErrorMessage { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } public string? SourceFileName { get; set; } public long? SourceFileSizeBytes { get; set; } public int? SourceWordCount { get; set; } public int? SourceCharacterCount { get; set; } public int? SourceChapterCount { get; set; } public int? SourceDetectedImagesCount { get; set; } public int? SourceDetectedTablesCount { get; set; } public int? SourceDetectedFootnotesCount { get; set; } public int? SourceDetectedCommentsCount { get; set; } public string? FailureStage { get; set; } public string? ErrorDetail { get; set; } public decimal? EstimatedCostGBP { get; set; } public decimal? EstimatedCostUSD { get; set; } public string? PromptVersionsSummary { get; set; } public string? SourceLabel { get; set; } public string? SourceText { get; set; } public string? CurrentStage { get; set; } public string? CurrentMessage { get; set; } public int? TotalDetectedScenes { get; set; } public int? CompletedScenes { get; set; } public int? FailedScenes { get; set; } public DateTime? CancellationRequestedUtc { get; set; } public DateTime? CancelledUtc { get; set; } public int? ChapterID { get; set; } public decimal? ChapterNumber { get; set; } public int? SourceParagraphCount { get; set; } public string? KnownCharactersJson { get; set; } } public sealed class ProjectBackupStoryIntelligenceChapterResults { public int ChapterResultID { get; set; } public int StoryIntelligenceRunID { get; set; } public int? ProjectID { get; set; } public int? BookID { get; set; } public int? ChapterID { get; set; } public decimal? ChapterNumber { get; set; } public string SourceLabel { get; set; } = ""; public string PromptVersion { get; set; } = ""; public string Model { get; set; } = ""; public string RawResponseJson { get; set; } = ""; public string OutputTextJson { get; set; } = ""; public string ParsedJson { get; set; } = ""; public int ValidationErrorsCount { get; set; } public int ValidationWarningsCount { get; set; } public int? InputTokens { get; set; } public int? OutputTokens { get; set; } public int? TotalTokens { get; set; } public long? DurationMs { get; set; } public DateTime CreatedUtc { get; set; } } public sealed class ProjectBackupStoryIntelligenceSceneResults { public int SceneResultID { get; set; } public int StoryIntelligenceRunID { get; set; } public int? ChapterResultID { get; set; } public int? ProjectID { get; set; } public int? BookID { get; set; } public int? ChapterID { get; set; } public int? SceneID { get; set; } public int TemporarySceneNumber { get; set; } public int? StartParagraph { get; set; } public int? EndParagraph { get; set; } public string SourceLabel { get; set; } = ""; public string PromptVersion { get; set; } = ""; public string Model { get; set; } = ""; public string RawResponseJson { get; set; } = ""; public string OutputTextJson { get; set; } = ""; public string ParsedJson { get; set; } = ""; public int ValidationErrorsCount { get; set; } public int ValidationWarningsCount { get; set; } public int? InputTokens { get; set; } public int? OutputTokens { get; set; } public int? TotalTokens { get; set; } public long? DurationMs { get; set; } public DateTime CreatedUtc { get; set; } } public sealed class ProjectBackupStoryIntelligenceImportCommits { public int StoryIntelligenceImportCommitID { get; set; } public int StoryIntelligenceRunID { get; set; } public int? ProjectID { get; set; } public int? BookID { get; set; } public int? ChapterID { get; set; } public DateTime CommittedAt { get; set; } public int CommittedByUserID { get; set; } public int ScenesCreated { get; set; } public int MetricsCreated { get; set; } public string Status { get; set; } = ""; public string? Notes { get; set; } public DateTime CreatedUtc { get; set; } } public sealed class ProjectBackupStoryIntelligenceBookPipelines { public int StoryIntelligenceBookPipelineID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public string CurrentStage { get; set; } = ""; public string? LastCompletedStage { get; set; } public string? CurrentReviewStage { get; set; } public string Status { get; set; } = ""; public DateTime? CompletedUtc { get; set; } public int? LastRunID { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } public DateTime? CompletionEmailQueuedUtc { get; set; } public DateTime? FailureEmailQueuedUtc { get; set; } public DateTime? CharacterReviewCompletedUtc { get; set; } public DateTime? LocationReviewCompletedUtc { get; set; } public DateTime? AssetReviewCompletedUtc { get; set; } public DateTime? RelationshipReviewCompletedUtc { get; set; } public DateTime? KnowledgeReviewCompletedUtc { get; set; } public DateTime? NarrativeReviewCompletedUtc { get; set; } } public sealed class ProjectBackupStoryMemoryCharacters { public int StoryMemoryCharacterID { get; set; } public int ImportSessionID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public string CanonicalIdentityKey { get; set; } = ""; public string DisplayName { get; set; } = ""; public string EntityContext { get; set; } = ""; public string SourceSectionType { get; set; } = ""; public bool IsNamed { get; set; } public bool IsGroupEntity { get; set; } public bool IsResolved { get; set; } public bool IsNarrator { get; set; } public bool IsPrimaryPOV { get; set; } public int Significance { get; set; } public int EvidenceVersion { get; set; } public int? CreatedSceneResultID { get; set; } public int? LastUpdatedSceneResultID { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } } public sealed class ProjectBackupStoryMemoryCharacterAliases { public int StoryMemoryCharacterAliasID { get; set; } public int StoryMemoryCharacterID { get; set; } public string Alias { get; set; } = ""; public string NormalisedAlias { get; set; } = ""; public string? ResolutionReason { get; set; } public int? SourceSceneResultID { get; set; } public decimal Confidence { get; set; } public DateTime CreatedUtc { get; set; } } public sealed class ProjectBackupStoryMemoryCharacterAttributes { public int StoryMemoryCharacterAttributeID { get; set; } public int StoryMemoryCharacterID { get; set; } public string AttributeType { get; set; } = ""; public string NormalisedValue { get; set; } = ""; public decimal Confidence { get; set; } public bool IsExplicit { get; set; } public string? EvidenceSummary { get; set; } public int? SourceSceneResultID { get; set; } public DateTime? SupersededUtc { get; set; } public DateTime CreatedUtc { get; set; } } public sealed class ProjectBackupStoryMemoryLocations { public int StoryMemoryLocationID { get; set; } public int ImportSessionID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public string CanonicalIdentityKey { get; set; } = ""; public string DisplayName { get; set; } = ""; public string SemanticType { get; set; } = ""; public string? Subtype { get; set; } public string? InteriorExterior { get; set; } public int? ParentLocationID { get; set; } public int? FirstSeenSceneResultID { get; set; } public int? LastSeenSceneResultID { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } } public sealed class ProjectBackupStoryMemoryAssets { public int StoryMemoryAssetID { get; set; } public int ImportSessionID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public string CanonicalIdentityKey { get; set; } = ""; public string DisplayName { get; set; } = ""; public string SemanticType { get; set; } = ""; public string? Subtype { get; set; } public string? Colour { get; set; } public string? Era { get; set; } public int? FirstSeenSceneResultID { get; set; } public int? LastSeenSceneResultID { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } } public sealed class ProjectBackupStoryMemoryRelationships { public int StoryMemoryRelationshipID { get; set; } public int ImportSessionID { get; set; } public string SourceEntityType { get; set; } = ""; public int SourceEntityID { get; set; } public string TargetEntityType { get; set; } = ""; public int TargetEntityID { get; set; } public string RelationshipType { get; set; } = ""; public decimal Confidence { get; set; } public bool IsExplicit { get; set; } public int? FirstSeenSceneResultID { get; set; } public int? LastUpdatedSceneResultID { get; set; } public bool Active { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } } public sealed class ProjectBackupStoryMemoryProcessedSceneResults { public int StoryMemoryProcessedSceneResultID { get; set; } public int ImportSessionID { get; set; } public int SceneResultID { get; set; } public string ProcessorVersion { get; set; } = ""; public string? SnapshotHash { get; set; } public DateTime ProcessedUtc { get; set; } } public sealed class ProjectBackupStoryMemoryImportPreferences { public int StoryMemoryImportPreferenceID { get; set; } public int ImportSessionID { get; set; } public string AppearancePreference { get; set; } = ""; public string ResolverVersion { get; set; } = ""; public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } public string? PrimaryAgeGroup { get; set; } public string? StoryEra { get; set; } public string? StoryLocation { get; set; } } public sealed class ProjectBackupCharacterIntelligenceProfiles { public int CharacterIntelligenceProfileID { get; set; } public int ImportSessionID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public string CanonicalIdentityKey { get; set; } = ""; public string CanonicalName { get; set; } = ""; public string ProfileJson { get; set; } = ""; public decimal Confidence { get; set; } public string? NarrativeImportance { get; set; } public bool IsRecurring { get; set; } public string EvidenceVersion { get; set; } = ""; public int? LastUpdatedSceneResultID { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } } public sealed class ProjectBackupCharacterIntelligenceEvidenceEvents { public int CharacterIntelligenceEvidenceEventID { get; set; } public int CharacterIntelligenceProfileID { get; set; } public int SceneResultID { get; set; } public string FieldName { get; set; } = ""; public string? PreviousValue { get; set; } public string? NewValue { get; set; } public string? Evidence { get; set; } public decimal Confidence { get; set; } public bool IsContradiction { get; set; } public string Source { get; set; } = ""; public DateTime CreatedUtc { get; set; } } public sealed class ProjectBackupStoryIntelligenceReviewCandidateGenerations { public int ReviewCandidateGenerationID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public string Module { get; set; } = ""; public string Status { get; set; } = ""; public string Source { get; set; } = ""; public int CandidateCount { get; set; } public int PendingCount { get; set; } public string? ErrorMessage { get; set; } public bool IsCurrent { get; set; } public DateTime CreatedUtc { get; set; } public DateTime? PreparedUtc { get; set; } public DateTime? FailedUtc { get; set; } public DateTime UpdatedUtc { get; set; } } public sealed class ProjectBackupStoryIntelligenceReviewCandidates { public int ReviewCandidateID { get; set; } public int ReviewCandidateGenerationID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public string Module { get; set; } = ""; public string StableKey { get; set; } = ""; public string? CandidateType { get; set; } public string DisplayName { get; set; } = ""; public int SortOrder { get; set; } public decimal? Confidence { get; set; } public int? ExistingCanonicalID { get; set; } public string DecisionStatus { get; set; } = ""; public string? DecisionAction { get; set; } public string? DecisionTargetKey { get; set; } public int? DecisionCanonicalID { get; set; } public string CandidatePayloadJson { get; set; } = ""; public DateTime CreatedUtc { get; set; } public DateTime? ReviewedUtc { get; set; } public DateTime UpdatedUtc { get; set; } public string ReviewPriority { get; set; } = ""; public string? AssessmentJson { get; set; } } public sealed class ProjectBackupStoryIntelligenceReviewCandidateEvidence { public int ReviewCandidateEvidenceID { get; set; } public int ReviewCandidateID { get; set; } public int? SceneID { get; set; } public string EvidenceText { get; set; } = ""; public decimal? Confidence { get; set; } public int SortOrder { get; set; } public DateTime CreatedUtc { get; set; } } public sealed class ProjectBackupCharacterEnrichmentRuns { public int CharacterEnrichmentRunID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public int UserID { get; set; } public int? StoryIntelligenceBookPipelineID { get; set; } public string CharacterResolutionVersion { get; set; } = ""; public string Status { get; set; } = ""; public int TotalCharacters { get; set; } public int ProcessedCharacters { get; set; } public string? CurrentStage { get; set; } public string? CurrentMessage { get; set; } public DateTime QueuedUtc { get; set; } public DateTime? StartedUtc { get; set; } public DateTime? CompletedUtc { get; set; } public DateTime? FailedUtc { get; set; } public int AttemptCount { get; set; } public string? Model { get; set; } public int? InputTokens { get; set; } public int? OutputTokens { get; set; } public int? TotalTokens { get; set; } public long? DurationMs { get; set; } public string? ErrorMessage { get; set; } public string? ErrorDetail { get; set; } public bool IsCurrent { get; set; } public DateTime UpdatedUtc { get; set; } public int? CharacterID { get; set; } } public sealed class ProjectBackupCharacterEnrichmentEvidence { public int CharacterEnrichmentEvidenceID { get; set; } public int CharacterEnrichmentRunID { get; set; } public int CharacterID { get; set; } public int? SceneID { get; set; } public string FieldName { get; set; } = ""; public string? Value { get; set; } public string? Evidence { get; set; } public decimal Confidence { get; set; } public string Source { get; set; } = ""; public DateTime CreatedUtc { get; set; } } public sealed class ProjectBackupWholeBookPlotSynthesisRuns { public int WholeBookPlotSynthesisRunID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public int UserID { get; set; } public int? SourceStoryIntelligenceRunID { get; set; } public string CharacterResolutionVersion { get; set; } = ""; public string Status { get; set; } = ""; public DateTime QueuedUtc { get; set; } public DateTime? StartedUtc { get; set; } public DateTime? CompletedUtc { get; set; } public DateTime? FailedUtc { get; set; } public int AttemptCount { get; set; } public string? Model { get; set; } public string? OpenAIResponseID { get; set; } public int? InputTokens { get; set; } public int? OutputTokens { get; set; } public int? CachedInputTokens { get; set; } public int? TotalTokens { get; set; } public long? DurationMs { get; set; } public string? ErrorMessage { get; set; } public string? ErrorDetail { get; set; } public string? ResultJson { get; set; } public bool IsCurrent { get; set; } public DateTime UpdatedUtc { get; set; } } public sealed class ProjectBackupStoryIntelligenceNarrativeCandidates { public int NarrativeCandidateID { get; set; } public int ProjectID { get; set; } public int BookID { get; set; } public string CandidateType { get; set; } = ""; public string CandidateKey { get; set; } = ""; public string ProposedTitle { get; set; } = ""; public string? ProposedDescription { get; set; } public string? Category { get; set; } public string? InferredState { get; set; } public int? ExistingPlotLineID { get; set; } public int? ExistingPlotThreadID { get; set; } public int? RelatedPlotLineID { get; set; } public decimal? Confidence { get; set; } public string Status { get; set; } = ""; public string? ReviewAction { get; set; } public int? AcceptedPlotLineID { get; set; } public int? AcceptedPlotThreadID { get; set; } public int? ReviewedByUserID { get; set; } public DateTime? ReviewedUtc { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } public string? ChangeType { get; set; } public string? Significance { get; set; } public string? ParentCandidateKey { get; set; } public int? ParentNarrativeCandidateID { get; set; } public int? MergeTargetNarrativeCandidateID { get; set; } public int? WholeBookPlotSynthesisRunID { get; set; } public int? AuthorPlotSeedID { get; set; } public decimal? ExistingPlotLineMatchConfidence { get; set; } public string? ExistingPlotLineMatchReason { get; set; } public decimal? SeedMatchConfidence { get; set; } public string? SeedMatchReason { get; set; } public string? Source { get; set; } } public sealed class ProjectBackupStoryIntelligenceNarrativeCandidateEvidence { public int NarrativeCandidateEvidenceID { get; set; } public int NarrativeCandidateID { get; set; } public int SceneID { get; set; } public string? ContributionType { get; set; } public string? Evidence { get; set; } public int SortOrder { get; set; } public DateTime CreatedUtc { get; set; } } public sealed class ProjectBackupStoryIntelligenceNarrativeCandidateEvents { public int NarrativeCandidateEventID { get; set; } public int NarrativeCandidateID { get; set; } public int? WholeBookPlotSynthesisRunID { get; set; } public string EventKey { get; set; } = ""; public int SceneID { get; set; } public string EventType { get; set; } = ""; public string EventTitle { get; set; } = ""; public string? EventDescription { get; set; } public string? Evidence { get; set; } public decimal? Confidence { get; set; } public int SortOrder { get; set; } public bool IsIgnored { get; set; } public int? AcceptedThreadEventID { get; set; } public DateTime CreatedUtc { get; set; } public DateTime UpdatedUtc { get; set; } }