| | | 1 | | using System; |
| | | 2 | | using System.ComponentModel.DataAnnotations; |
| | | 3 | | using System.ComponentModel.DataAnnotations.Schema; |
| | | 4 | | using Jellyfin.Database.Implementations.Interfaces; |
| | | 5 | | |
| | | 6 | | namespace Jellyfin.Database.Implementations.Entities.Libraries |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// An entity representing a chapter. |
| | | 10 | | /// </summary> |
| | | 11 | | public class Chapter : IHasConcurrencyToken |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Initializes a new instance of the <see cref="Chapter"/> class. |
| | | 15 | | /// </summary> |
| | | 16 | | /// <param name="language">ISO-639-3 3-character language codes.</param> |
| | | 17 | | /// <param name="startTime">The start time for this chapter.</param> |
| | | 18 | | public Chapter(string language, long startTime) |
| | | 19 | | { |
| | 0 | 20 | | ArgumentException.ThrowIfNullOrEmpty(language); |
| | | 21 | | |
| | 0 | 22 | | Language = language; |
| | 0 | 23 | | StartTime = startTime; |
| | 0 | 24 | | } |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Gets the id. |
| | | 28 | | /// </summary> |
| | | 29 | | /// <remarks> |
| | | 30 | | /// Identity, Indexed, Required. |
| | | 31 | | /// </remarks> |
| | | 32 | | [DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
| | | 33 | | public int Id { get; private set; } |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// Gets or sets the name. |
| | | 37 | | /// </summary> |
| | | 38 | | /// <remarks> |
| | | 39 | | /// Max length = 1024. |
| | | 40 | | /// </remarks> |
| | | 41 | | [MaxLength(1024)] |
| | | 42 | | [StringLength(1024)] |
| | | 43 | | public string? Name { get; set; } |
| | | 44 | | |
| | | 45 | | /// <summary> |
| | | 46 | | /// Gets or sets the language. |
| | | 47 | | /// </summary> |
| | | 48 | | /// <remarks> |
| | | 49 | | /// Required, Min length = 3, Max length = 3 |
| | | 50 | | /// ISO-639-3 3-character language codes. |
| | | 51 | | /// </remarks> |
| | | 52 | | [MinLength(3)] |
| | | 53 | | [MaxLength(3)] |
| | | 54 | | [StringLength(3)] |
| | | 55 | | public string Language { get; set; } |
| | | 56 | | |
| | | 57 | | /// <summary> |
| | | 58 | | /// Gets or sets the start time. |
| | | 59 | | /// </summary> |
| | | 60 | | /// <remarks> |
| | | 61 | | /// Required. |
| | | 62 | | /// </remarks> |
| | | 63 | | public long StartTime { get; set; } |
| | | 64 | | |
| | | 65 | | /// <summary> |
| | | 66 | | /// Gets or sets the end time. |
| | | 67 | | /// </summary> |
| | | 68 | | public long? EndTime { get; set; } |
| | | 69 | | |
| | | 70 | | /// <inheritdoc /> |
| | | 71 | | [ConcurrencyCheck] |
| | | 72 | | public uint RowVersion { get; private set; } |
| | | 73 | | |
| | | 74 | | /// <inheritdoc /> |
| | | 75 | | public void OnSavingChanges() |
| | | 76 | | { |
| | 0 | 77 | | RowVersion++; |
| | 0 | 78 | | } |
| | | 79 | | } |
| | | 80 | | } |