using System.Collections.Generic; namespace RMuseum.Models.Ganjoor.ViewModels { /// /// deserialized shape of GanjoorPoemGeoDateTagCorrection.SuggestedPersonGraphJson - a brand new /// person (optionally linked to other people, new or existing) suggested in one go alongside a /// poem's geo/date/person tag. See that field's doc comment for the full JSON shape. /// public class PersonGraphSuggestion { /// /// the node that ends up assigned to the tag's PersonId once approved /// public PersonGraphNode Person { get; set; } /// /// other people this submission also introduces or links to, referenced from Relations by /// their LocalKey /// public List RelatedPeople { get; set; } /// /// kinship and/or non-family edges between any of Person/RelatedPeople's local keys /// public List Relations { get; set; } } /// /// one person node in a PersonGraphSuggestion - either a link to an existing, already approved /// GanjoorRelatedPerson (ExistingPersonId set, the rest ignored) or a brand new person to create /// (ExistingPersonId null, the rest describing them) /// public class PersonGraphNode { /// /// key used only to resolve Relations entries within this same submission - never stored /// beyond approval time /// public string LocalKey { get; set; } /// /// set to link to an existing, already approved person instead of creating a new one - when /// set, every other field on this node is ignored /// public int? ExistingPersonId { get; set; } public string Name { get; set; } public string Description { get; set; } public string WikiUrl { get; set; } public int? BirthYearInLHijri { get; set; } public int? DeathYearInLHijri { get; set; } public bool ValidBirthDate { get; set; } public bool ValidDeathDate { get; set; } public int? BirthLocationId { get; set; } public int? DeathLocationId { get; set; } /// /// see GanjoorRelatedPerson.FamilyTreeCaption - only meaningful for whichever node is meant /// to be a tree's named root /// public string FamilyTreeCaption { get; set; } /// /// name of a PersonImportance value ("Normal", "Important", "VeryImportant") - same /// string-enum convention as PersonGraphRelationEntry.RelationType/AffiliationType below. /// Null/empty is treated as Normal. /// public string Importance { get; set; } /// /// name of a PersonGender value ("Unknown", "Male", "Female") - same string-enum convention /// as Importance above. Null/empty is treated as Unknown. /// public string Gender { get; set; } /// /// only meaningful when ExistingPersonId is null (a brand new person is being created). /// Normally, if Name exactly matches an already-approved GanjoorRelatedPerson, /// _MaterializePersonGraphAsync rejects the submission rather than silently creating a /// near-duplicate node - the far more common case is a contributor who free-typed a name /// instead of picking the existing person via the search-as-you-type selector. Set this to /// true only when the name collision is known/intentional (e.g. two distinct Shahnameh /// characters sharing a name) to let the new person be created anyway. /// public bool ConfirmedNewDespiteNameMatch { get; set; } } /// /// one edge in a PersonGraphSuggestion, between two nodes referenced by their LocalKey (Person1/ /// Person2 - matching PersonGraphNode.LocalKey, not a real database id yet). Kind picks which /// enum RelationType/AffiliationType is parsed against and which live table the edge is /// materialized into on approval. /// public class PersonGraphRelationEntry { /// /// "family" (default, materialized as GanjoorPersonRelation - RelationType against /// PersonRelationType) or "affiliation" (materialized as GanjoorPersonAffiliation - /// AffiliationType against PersonAffiliationType) /// public string Kind { get; set; } public string Person1 { get; set; } public string Person2 { get; set; } /// /// parsed against PersonRelationType when Kind is "family" /// public string RelationType { get; set; } /// /// parsed against PersonAffiliationType when Kind is "affiliation" /// public string AffiliationType { get; set; } /// /// only meaningful for a family relation of type Ancestor - see GanjoorPersonRelation.DegreeHint /// public int? DegreeHint { get; set; } public string Note { get; set; } } }