aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Models/SystemInfoDtos/LibraryStorageDto.cs
blob: c138324d2e6880c522da9e53e8ad99a336db2b76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Model.System;

namespace Jellyfin.Api.Models.SystemInfoDtos;

/// <summary>
/// Contains informations about a libraries storage informations.
/// </summary>
public record LibraryStorageDto
{
      /// <summary>
    /// Gets or sets the Library Id.
    /// </summary>
    public required Guid Id { get; set; }

    /// <summary>
    /// Gets or sets the name of the library.
    /// </summary>
    public required string Name { get; set; }

    /// <summary>
    /// Gets or sets the storage informations about the folders used in a library.
    /// </summary>
    public required IReadOnlyCollection<FolderStorageDto> Folders { get; set; }

    internal static LibraryStorageDto FromLibraryStorageModel(LibraryStorageInfo model)
    {
        return new()
        {
            Id = model.Id,
            Name = model.Name,
            Folders = model.Folders.Select(FolderStorageDto.FromFolderStorageInfo).ToArray()
        };
    }
}