81 lines
2.5 KiB
C#
81 lines
2.5 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace PlotLine.Models;
|
|
|
|
public sealed class PlotLineImportPackage
|
|
{
|
|
public string? PackageVersion { get; set; }
|
|
public string? Source { get; set; }
|
|
public ImportProjectDto Project { get; set; } = new();
|
|
public List<ImportBookDto> Books { get; set; } = [];
|
|
|
|
[JsonExtensionData]
|
|
public Dictionary<string, object>? ExtensionData { get; set; }
|
|
}
|
|
|
|
public sealed class ImportProjectDto
|
|
{
|
|
public string Title { get; set; } = string.Empty;
|
|
public string? Description { get; set; }
|
|
public string? Notes { get; set; }
|
|
}
|
|
|
|
public sealed class ImportBookDto
|
|
{
|
|
public string Title { get; set; } = string.Empty;
|
|
public string? Subtitle { get; set; }
|
|
public int SeriesOrder { get; set; }
|
|
public bool DependsOnPreviousBook { get; set; }
|
|
public string? Description { get; set; }
|
|
public string? Notes { get; set; }
|
|
public List<ImportChapterDto> Chapters { get; set; } = [];
|
|
}
|
|
|
|
public sealed class ImportChapterDto
|
|
{
|
|
public decimal ChapterNumber { get; set; }
|
|
public string Title { get; set; } = string.Empty;
|
|
public int Order { get; set; }
|
|
public string? Summary { get; set; }
|
|
public string? Notes { get; set; }
|
|
public List<ImportSceneDto> Scenes { get; set; } = [];
|
|
}
|
|
|
|
public sealed class ImportSceneDto
|
|
{
|
|
public decimal SceneNumber { get; set; }
|
|
public string Title { get; set; } = string.Empty;
|
|
public int Order { get; set; }
|
|
public string? Summary { get; set; }
|
|
public string? PovCharacterName { get; set; }
|
|
public string? LocationName { get; set; }
|
|
public string? DateTimeText { get; set; }
|
|
public string? PurposeText { get; set; }
|
|
public string? OutcomeText { get; set; }
|
|
public string? Notes { get; set; }
|
|
}
|
|
|
|
public sealed class ImportValidationResult
|
|
{
|
|
public bool IsValid => Errors.Count == 0;
|
|
public List<string> Errors { get; } = [];
|
|
public List<string> Warnings { get; } = [];
|
|
}
|
|
|
|
public sealed class ImportPreview
|
|
{
|
|
public PlotLineImportPackage? Package { get; init; }
|
|
public ImportValidationResult Validation { get; init; } = new();
|
|
public bool HasDuplicateProjectTitle { get; init; }
|
|
public int BookCount => Package?.Books.Count ?? 0;
|
|
public int ChapterCount => Package?.Books.Sum(book => book.Chapters.Count) ?? 0;
|
|
public int SceneCount => Package?.Books.Sum(book => book.Chapters.Sum(chapter => chapter.Scenes.Count)) ?? 0;
|
|
}
|
|
|
|
public sealed class ImportResult
|
|
{
|
|
public bool Succeeded { get; init; }
|
|
public int? ProjectID { get; init; }
|
|
public string Message { get; init; } = string.Empty;
|
|
}
|