using TeleWave.Domain.Media;

namespace TeleWave.Application.Media;

public sealed record MediaAssetDto(
    Guid Id,
    string OriginalFileName,
    MediaSource Source,
    MediaAssetStatus Status,
    double? DurationSeconds,
    int? SegmentCount,
    int? Width,
    int? Height,
    string? VideoCodec,
    string? AudioCodec,
    string? ErrorMessage,
    double? ProcessingSeconds,
    DateTimeOffset CreatedAt
)
{
    public static MediaAssetDto From(MediaAsset asset) =>
        new(
            asset.Id,
            asset.OriginalFileName,
            asset.Source,
            asset.Status,
            asset.Duration?.TotalSeconds,
            asset.SegmentCount,
            asset.Width,
            asset.Height,
            asset.VideoCodec,
            asset.AudioCodec,
            asset.ErrorMessage,
            asset.ProcessingDuration?.TotalSeconds,
            asset.CreatedAt
        );
}
