| | 1 | | #nullable disable |
| | 2 | |
|
| | 3 | | #pragma warning disable CS1591 |
| | 4 | |
|
| | 5 | | using System; |
| | 6 | | using System.Globalization; |
| | 7 | | using System.Text.Json.Serialization; |
| | 8 | |
|
| | 9 | | namespace MediaBrowser.Controller.Entities |
| | 10 | | { |
| | 11 | | public class LinkedChild |
| | 12 | | { |
| | 13 | | public LinkedChild() |
| | 14 | | { |
| 0 | 15 | | Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); |
| 0 | 16 | | } |
| | 17 | |
|
| | 18 | | public string Path { get; set; } |
| | 19 | |
|
| | 20 | | public LinkedChildType Type { get; set; } |
| | 21 | |
|
| | 22 | | public string LibraryItemId { get; set; } |
| | 23 | |
|
| | 24 | | [JsonIgnore] |
| | 25 | | public string Id { get; set; } |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// Gets or sets the linked item id. |
| | 29 | | /// </summary> |
| | 30 | | public Guid? ItemId { get; set; } |
| | 31 | |
|
| | 32 | | public static LinkedChild Create(BaseItem item) |
| | 33 | | { |
| 0 | 34 | | var child = new LinkedChild |
| 0 | 35 | | { |
| 0 | 36 | | Path = item.Path, |
| 0 | 37 | | Type = LinkedChildType.Manual |
| 0 | 38 | | }; |
| | 39 | |
|
| 0 | 40 | | if (string.IsNullOrEmpty(child.Path)) |
| | 41 | | { |
| 0 | 42 | | child.LibraryItemId = item.Id.ToString("N", CultureInfo.InvariantCulture); |
| | 43 | | } |
| | 44 | |
|
| 0 | 45 | | return child; |
| | 46 | | } |
| | 47 | | } |
| | 48 | | } |