using SurrealDb.Net.Models;

namespace RelayShared.Rtc;

public sealed class DBActiveCall : Record
{
    public string ChannelId { get; set; } = string.Empty;
    public string? OfferUser { get; set; }
    public RtcSessionDescription? Offer { get; set; }
    public RtcSessionDescription? Answer { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
    public bool IsActive { get; set; }
    public string[] IceCandidates { get; set; } = []; //TODO: Should be array of DBIceCandidates IDs
}

public sealed class DBOffer : Record
{
    public string ChannelId { get; set; } = string.Empty;
    public string Username { get; set; } = string.Empty;
    public string Type { get; set; } = string.Empty;
    public string Sdp { get; set; } = string.Empty;
}
public sealed class DBAnswer : Record
{
    public string ChannelId { get; set; } = string.Empty;
    public string Username { get; set; } = string.Empty;
    public string Type { get; set; } = string.Empty;
    public string Sdp { get; set; } = string.Empty;
}

public class DBIceCandidate : Record
{
    public required string ChannelId { get; set; }
    public required string Username { get; set; }
    public required string Candidate { get; set; }
    public string? SdpMid { get; set; }
    public int? SdpMLineIndex { get; set; }
    public DateTime CreatedAt { get; set; }
}