using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; namespace Yavsc.Abstract.Streaming; /// The lifecycle of a retained live broadcast. [JsonConverter(typeof(JsonStringEnumConverter))] public enum PodcastState { Live, Completed, Interrupted } /// Preparation state of the seekable MP4 copy of a completed broadcast. [JsonConverter(typeof(JsonStringEnumConverter))] public enum PodcastReplayState { Pending, Processing, Ready, Failed } /// Persistent MP4 preparation result; source segments are retained. public sealed record PodcastReplayResponse(PodcastReplayState State, long Bytes = 0, string? Error = null); /// Creates an authenticated live broadcast with a retained replay. public sealed record CreatePodcastRequest { [Required, StringLength(160, MinimumLength = 1)] public required string Title { get; init; } } /// A broadcast available to authenticated listeners. public sealed record PodcastResponse( Guid Id, string Title, string OwnerId, string OwnerName, DateTimeOffset CreatedAt, DateTimeOffset UpdatedAt, PodcastState State, int SegmentCount, long Bytes, double DurationSeconds) { public PodcastReplayResponse? Replay { get; init; } } /// An independently decodable MPEG-TS HLS segment. public sealed record PodcastSegmentResponse(int Sequence, double DurationSeconds, int Bytes); /// The ordered, committed segments of a live broadcast or replay. public sealed record PodcastManifestResponse( PodcastResponse Podcast, IReadOnlyList Segments);