using MBN_STOCK_WEBVIEW.Core.Playout;
using MBN_STOCK_WEBVIEW.Core.Playout.Scenes;

namespace MBN_STOCK_WEBVIEW.LegacyApplication;

public enum LegacyOperatorPlayoutPhase
{
    Idle,
    Prepared,
    Program
}

public enum LegacyOperatorPlayoutCommand
{
    Prepare,
    TakeIn,
    Next,
    TakeOut
}

public sealed record LegacyOperatorPlayoutRequest(
    IReadOnlyList<LegacyPlaylistEntry> Playlist,
    int SelectedIndexZeroBased);

public sealed record LegacyOperatorPlayoutSnapshot(
    PlayoutMode Mode,
    PlayoutConnectionState ConnectionState,
    LegacyOperatorPlayoutPhase Phase,
    bool IsProcessRunning,
    bool IsConnected,
    bool IsCommandAvailable,
    bool LiveTakeInAllowed,
    bool IsPlayCompletionPending,
    bool OutcomeUnknown,
    string? PreparedCode,
    string? OnAirCode,
    int CurrentCueIndexZeroBased,
    string? CurrentEntryId,
    string? BuilderKey,
    int PageIndexZeroBased,
    int PageCount,
    int PageSize,
    int ItemCount,
    int CurrentPageItemCount,
    bool IsLastPage,
    LegacyWorkflowNextKind NextKind,
    bool IsBusy,
    bool RefreshActive,
    int RefreshCompletedCount,
    int? RefreshMaximumCount,
    bool RefreshLimitReached,
    int FadeDuration,
    bool BackgroundEnabled,
    string BackgroundFileName,
    bool CanChangeBackground,
    string Message)
{
    public int OnAirCueIndexZeroBased { get; init; } = -1;

    public string? OnAirEntryId { get; init; }

    public bool IsTakeOutCompletionPending { get; init; }

    public DateTimeOffset? RefreshNextAtUtc { get; init; }

    public DateTimeOffset? RefreshLastSuccessAtUtc { get; init; }

    public string? RefreshFaultCode { get; init; }
}
