namespace Ikar.Shared;

public enum CallMediaType
{
    Audio = 0,
    Video = 1
}

public sealed record OutgoingCallDto(
    Guid CallId,
    Guid ChatId,
    UserSummaryDto Peer,
    CallMediaType MediaType);

public sealed record IncomingCallDto(
    Guid CallId,
    Guid ChatId,
    UserSummaryDto Caller,
    CallMediaType MediaType);

public sealed record CallConnectedDto(
    Guid CallId,
    Guid ChatId,
    DateTimeOffset ConnectedAt,
    CallMediaType MediaType,
    IReadOnlyList<CallIceServerDto> IceServers,
    bool ShouldCreateOffer);

public sealed record CallEndedDto(
    Guid CallId,
    Guid ChatId,
    string Reason,
    CallMediaType MediaType);

public sealed record CallIceServerDto(
    IReadOnlyList<string> Urls,
    string? Username = null,
    string? Credential = null);

public sealed record CallOfferDto(
    Guid CallId,
    string Type,
    string Sdp);

public sealed record CallAnswerDto(
    Guid CallId,
    string Type,
    string Sdp);

public sealed record CallIceCandidateDto(
    Guid CallId,
    string Candidate,
    string? SdpMid,
    int SdpMLineIndex);
