using System.Text.Json.Serialization; namespace FileShare_Services.Services.FileLibrary { /// /// 添加文件库根目录的请求。 /// public sealed record AddLibraryRootRequest( [property: JsonPropertyName("path")] string? Path, [property: JsonPropertyName("displayName")] string? DisplayName = null, [property: JsonPropertyName("scanIntervalMinutes")] int? ScanIntervalMinutes = null); /// /// 更新文件库根目录启用状态的请求。 /// public sealed record UpdateLibraryRootRequest( [property: JsonPropertyName("id")] int Id, [property: JsonPropertyName("isEnabled")] bool IsEnabled); /// /// 触发文件库根目录立即扫描的请求。 /// public sealed record ScanLibraryRootRequest( [property: JsonPropertyName("id")] int Id); /// /// 删除文件库根目录的请求。 /// public sealed record DeleteLibraryRootRequest( [property: JsonPropertyName("id")] int Id); /// /// 查询服务器子目录的请求。 /// public sealed record DirectoryQueryRequest( [property: JsonPropertyName("path")] string? Path); /// /// 根据 ID 查询文件的请求。 /// public sealed record FileQueryRequest( [property: JsonPropertyName("id")] int Id); /// /// 获取最近文件的请求。 /// public sealed record RecentFilesRequest( [property: JsonPropertyName("type")] string Type = "added", [property: JsonPropertyName("count")] int Count = 12); /// /// 标记文件已播放的请求。 /// public sealed record MarkFilePlayedRequest( [property: JsonPropertyName("id")] int Id); /// /// 分页搜索已扫描文件的请求。 /// public sealed record SearchFilesRequest( [property: JsonPropertyName("page")] int Page = 1, [property: JsonPropertyName("pageSize")] int PageSize = 24, [property: JsonPropertyName("mediaType")] string? MediaType = null, [property: JsonPropertyName("keyword")] string? Keyword = null, [property: JsonPropertyName("rootId")] int RootId = 0); /// /// 磁盘驱动器信息。 /// public sealed record DriveDto( string Name, string DisplayName, string RootDirectory, string DriveType, long? TotalSize, long? AvailableFreeSpace, bool IsReady); /// /// 服务器子目录信息。 /// public sealed record DirectoryDto( string Name, string FullPath); /// /// 文件库根目录信息,包含扫描状态与文件数量。 /// public sealed record LibraryRootDto( int Id, string Path, string DisplayName, bool IsEnabled, bool IsAvailable, int ScanIntervalMinutes, DateTime? LastScanStartedAt, DateTime? LastScanCompletedAt, string? LastScanError, int FileCount); /// /// 已扫描文件的记录信息,包含媒体类型与流式访问 URL。 /// public sealed record FileRecordDto( int Id, int LibraryRootId, string FileName, string RelativePath, string Extension, long SizeBytes, DateTime LastWriteTimeUtc, string MediaType, string ContentType, string StreamUrl, string? TextUrl, bool BrowserPlayable, string? ThumbnailUrl = null, double? VideoDuration = null, DateTime? LastPlayedAt = null); /// /// 浏览文件库目录结构的请求。 /// public sealed record BrowseDirectoryRequest( [property: JsonPropertyName("rootId")] int RootId = 0, [property: JsonPropertyName("path")] string? Path = null); /// /// 浏览文件库目录的响应,包含当前路径、子目录列表和文件列表。 /// public sealed record BrowseDirectoryResponse( string CurrentPath, List Subdirectories, List Files); /// /// 文本文件预览内容,支持截断标记。 /// public sealed record TextPreviewDto( int Id, string FileName, string Content, bool Truncated); }