using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Jellyfin.Data.Interfaces; namespace Jellyfin.Data.Entities.Libraries { /// /// An entity representing a chapter. /// public class Chapter : IHasConcurrencyToken { /// /// Initializes a new instance of the class. /// /// ISO-639-3 3-character language codes. /// The start time for this chapter. public Chapter(string language, long startTime) { ArgumentException.ThrowIfNullOrEmpty(language); Language = language; StartTime = startTime; } /// /// Gets the id. /// /// /// Identity, Indexed, Required. /// [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; private set; } /// /// Gets or sets the name. /// /// /// Max length = 1024. /// [MaxLength(1024)] [StringLength(1024)] public string? Name { get; set; } /// /// Gets or sets the language. /// /// /// Required, Min length = 3, Max length = 3 /// ISO-639-3 3-character language codes. /// [MinLength(3)] [MaxLength(3)] [StringLength(3)] public string Language { get; set; } /// /// Gets or sets the start time. /// /// /// Required. /// public long StartTime { get; set; } /// /// Gets or sets the end time. /// public long? EndTime { get; set; } /// [ConcurrencyCheck] public uint RowVersion { get; private set; } /// public void OnSavingChanges() { RowVersion++; } } }