using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Jellyfin.Data.Enums; using Jellyfin.Data.Interfaces; namespace Jellyfin.Data.Entities.Libraries { /// /// An entity representing a person's role in media. /// public class PersonRole : IHasArtwork, IHasConcurrencyToken { /// /// Initializes a new instance of the class. /// /// The role type. /// The person. public PersonRole(PersonRoleType type, Person person) { Type = type; Person = person; Artwork = new HashSet(); Sources = new HashSet(); } /// /// Gets the id. /// /// /// Identity, Indexed, Required. /// [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; private set; } /// /// Gets or sets the name of the person's role. /// /// /// Max length = 1024. /// [MaxLength(1024)] [StringLength(1024)] public string? Role { get; set; } /// /// Gets or sets the person's role type. /// /// /// Required. /// public PersonRoleType Type { get; set; } /// [ConcurrencyCheck] public uint RowVersion { get; private set; } /// /// Gets or sets the person. /// /// /// Required. /// public virtual Person Person { get; set; } /// public virtual ICollection Artwork { get; private set; } /// /// Gets a collection containing the metadata sources for this person role. /// public virtual ICollection Sources { get; private set; } /// public void OnSavingChanges() { RowVersion++; } } }