using RMuseum.Models.Ganjoor; using RMuseum.Models.Ganjoor.ViewModels; using RSecurityBackend.Models.Generic; using System; using System.Threading.Tasks; namespace RMuseum.Services { /// /// related people (family tree / person tagging) service. A new person is normally created via /// the geo/date/person tag correction's SuggestedPersonGraphJson, materialized on moderator /// approval (see GanjoorService-ModeratePoemCorrection.cs). Editing an already-approved person's /// own fields (e.g. adding a FamilyTreeCaption after the fact) goes through the suggest/review /// queue below (SuggestPersonEditAsync / ModeratePersonEditSuggestionAsync) - there is no /// direct-edit path; nothing ever writes to a GanjoorRelatedPerson's fields except that approval /// step and the original creation-on-approval in GanjoorService-ModeratePoemCorrection.cs. /// public interface IGanjoorRelatedPersonService { /// /// get all people (for the search-as-you-type person picker) /// /// Task> GetPeopleAsync(); /// /// get person by id /// /// /// Task> GetPersonAsync(int id); /// /// get people who caption a family tree (GanjoorRelatedPerson.FamilyTreeCaption not empty) - /// used as the entry points for browsing family trees /// /// Task> GetFamilyTreeRootsAsync(); /// /// get a person along with all their kinship/affiliation edges (resolved with the other /// side's name), for the read-only person/family-tree browsing page /// /// /// Task> GetPersonRelationsAsync(int id); /// /// get the (approved, materialized) poem geo/date tags that name this person, each carrying /// enough of its Poem to link to it /// /// /// Task> GetPoemsByPersonAsync(int id); /// /// get the whole connected kinship component reachable from this person (ancestors, /// descendants, spouses, siblings - whichever edges connect to it, transitively), for the /// interactive family-tree chart at /FamilyTree/{id} /// /// /// Task> GetFamilyTreeAsync(int rootId); /// /// submit a suggested edit to an already-approved person's own fields - goes into the /// pending queue, does not change the person itself until a moderator approves it /// /// /// Task> SuggestPersonEditAsync(GanjoorPersonEditSuggestion suggestion); /// /// get the next unreviewed person-edit suggestion (for the moderator queue), including the /// target person's current fields (for a before/after diff) and the suggester's nickname /// /// /// Task> GetNextUnreviewedPersonEditSuggestionAsync(int skip); /// /// unreviewed person-edit suggestion count /// /// Task> GetUnreviewedPersonEditSuggestionCountAsync(); /// /// apply a moderator's decision to a pending person-edit suggestion. On Approved, copies the /// suggestion's Suggested* fields onto the target GanjoorRelatedPerson (Id and /// MachineGenerated on the person are left untouched); any other result just marks the /// suggestion reviewed/rejected without touching the person. /// /// /// /// /// /// Task> ModeratePersonEditSuggestionAsync(Guid moderatorUserId, int suggestionId, CorrectionReviewResult result, string reviewNote); /// /// get a single kinship edge by its own id, with both sides' names resolved - used by /// /User/SuggestPersonRelationEdit?relationId={relationId} to show what it's about /// /// /// Task> GetRelationByIdAsync(int relationId); /// /// submit a suggested addition, change or removal of a kinship edge - goes into the /// pending queue, does not change anything until a moderator approves it /// /// /// Task> SuggestPersonRelationEditAsync(GanjoorPersonRelationEditSuggestion suggestion); /// /// get the next unreviewed relation-edit suggestion (for the moderator queue) /// /// /// Task> GetNextUnreviewedPersonRelationEditSuggestionAsync(int skip); /// /// unreviewed relation-edit suggestion count /// /// Task> GetUnreviewedPersonRelationEditSuggestionCountAsync(); /// /// apply a moderator's decision to a pending relation-edit suggestion. On Approved: Add /// creates a new GanjoorPersonRelation, Modify updates the existing one ExistingRelationId /// points to, Remove deletes it (and auto-rejects any other still-pending suggestion that /// also targeted that same now-gone relation, so it doesn't dangle). /// /// /// /// /// /// Task> ModeratePersonRelationEditSuggestionAsync(Guid moderatorUserId, int suggestionId, CorrectionReviewResult result, string reviewNote); /// /// get the whole known network of people (every person with at least one kinship edge or /// non-family tie, plus every one of those edges/ties) for the force-directed "ontology" /// explorer opened via the PeopleExplorer.open() modal (formerly the standalone page /// /PeopleGraph) - see GanjoorPersonGraphViewModel /// /// Task> GetPersonGraphAsync(); /// /// get the network of people relevant to one work/category (a poet's whole corpus, one book /// like the Shahnameh, or a narrower story within it) - every person tagged in a poem under /// catId's subtree, plus their relatives/affiliates one hop out even if never tagged /// themselves - see GanjoorPersonGraphNode.DirectlyTagged /// /// /// Task> GetCatPersonGraphAsync(int catId); } }