PlotDirector/PlotLine/Models/NameIntelligenceModels.cs

162 lines
6.0 KiB
C#

namespace PlotLine.Models;
public static class NameIntelligenceReferencePackage
{
public const string PackageId = "plotdirector-name-intelligence";
public const string Version = "1.0.0";
public const string RelativePath = "Data/Reference/Names/v1.0.0";
}
public sealed class NameLocale
{
public int NameLocaleID { get; set; }
public string LocaleCode { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
public string IsoCountryCode { get; set; } = string.Empty;
public string EvidenceBasis { get; set; } = string.Empty;
public decimal DefaultConfidence { get; set; }
public int SortOrder { get; set; }
public bool IsActive { get; set; }
}
public sealed class GivenNameReference
{
public int GivenNameID { get; set; }
public string GivenNameKey { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
public string NormalisedName { get; set; } = string.Empty;
public string NameType { get; set; } = string.Empty;
public bool IsWordAmbiguous { get; set; }
public bool IsActive { get; set; }
public string? Notes { get; set; }
}
public sealed class NameUsageProfile
{
public int NameUsageID { get; set; }
public string UsageKey { get; set; } = string.Empty;
public int GivenNameID { get; set; }
public int NameLocaleID { get; set; }
public string LocaleCode { get; set; } = string.Empty;
public string LocaleDisplayName { get; set; } = string.Empty;
public int BirthYearFrom { get; set; }
public int BirthYearTo { get; set; }
public decimal MaleWeight { get; set; }
public decimal FemaleWeight { get; set; }
public decimal UsageWeight { get; set; }
public decimal Confidence { get; set; }
public string SourceType { get; set; } = string.Empty;
public string? SourceReference { get; set; }
public bool IsActive { get; set; }
public string? Notes { get; set; }
public string YearMatchKind { get; set; } = string.Empty;
}
public sealed class NameRelationshipReference
{
public int NameRelationshipID { get; set; }
public string RelationshipKey { get; set; } = string.Empty;
public int FromGivenNameID { get; set; }
public int ToGivenNameID { get; set; }
public string FromDisplayName { get; set; } = string.Empty;
public string ToDisplayName { get; set; } = string.Empty;
public string RelationshipType { get; set; } = string.Empty;
public decimal Strength { get; set; }
public bool IsBidirectional { get; set; }
public bool IsActive { get; set; }
public string? CurationSource { get; set; }
public string? Notes { get; set; }
}
public sealed class NameUsageDecoration
{
public string MatchedName { get; set; } = string.Empty;
public string MatchType { get; set; } = string.Empty;
public int CharacterID { get; set; }
public string CharacterName { get; set; } = string.Empty;
public int ProjectID { get; set; }
public string ProjectName { get; set; } = string.Empty;
public int? BookID { get; set; }
public string? BookTitle { get; set; }
public string? BookSubtitle { get; set; }
public string Scope { get; set; } = string.Empty;
public string BookDisplayTitle => BookTitleFormatter.DisplayTitle(BookTitle, BookSubtitle);
}
public sealed class NameRecognitionResult
{
public bool Recognised { get; init; }
public GivenNameReference? Name { get; init; }
public NameUsageProfile? Usage { get; init; }
public IReadOnlyList<NameRelationshipReference> RelatedForms { get; init; } = [];
public string Message { get; init; } = "No reference evidence.";
}
public sealed class NameSearchFilter
{
public int ProjectID { get; set; }
public int? BookID { get; set; }
public string? Search { get; set; }
public string? LocaleCode { get; set; } = "en-US";
public int? BirthYear { get; set; }
public string? GenderPreference { get; set; }
public decimal? GenderThreshold { get; set; }
public string? NameType { get; set; }
public decimal? MinimumUsage { get; set; }
public string UsedScope { get; set; } = "Project";
public bool? UsedOnly { get; set; }
public int Page { get; set; } = 1;
public int PageSize { get; set; } = 25;
}
public sealed class NameSearchResult
{
public int GivenNameID { get; set; }
public string GivenNameKey { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
public string NormalisedName { get; set; } = string.Empty;
public string NameType { get; set; } = string.Empty;
public bool IsWordAmbiguous { get; set; }
public decimal? MaleWeight { get; set; }
public decimal? FemaleWeight { get; set; }
public decimal? UsageWeight { get; set; }
public decimal? Confidence { get; set; }
public int? BirthYearFrom { get; set; }
public int? BirthYearTo { get; set; }
public string? LocaleCode { get; set; }
public string? LocaleDisplayName { get; set; }
public string? SourceType { get; set; }
public string? RelatedForms { get; set; }
public string? UsedSummary { get; set; }
public int UsedCount { get; set; }
public int TotalRows { get; set; }
}
public sealed class NameReferenceImportStatus
{
public int? NameReferenceImportID { get; set; }
public string PackageID { get; set; } = string.Empty;
public string SemanticVersion { get; set; } = string.Empty;
public string? PackageChecksum { get; set; }
public DateTime? StartedUtc { get; set; }
public DateTime? CompletedUtc { get; set; }
public bool Succeeded { get; set; }
public int LocaleRows { get; set; }
public int GivenNameRows { get; set; }
public int RelationshipRows { get; set; }
public int UsageRows { get; set; }
public string? ErrorSummary { get; set; }
}
public sealed record NameReferenceImportResult(
bool Succeeded,
bool AlreadyCurrent,
string Message,
string PackageId,
string Version,
int LocaleRows,
int GivenNameRows,
int RelationshipRows,
int UsageRows,
IReadOnlyList<string> Errors);