package dto

// AgoraCredentials is everything one party needs to join one consultation.
//
// RTM is the control plane and is present for every medium: the accept
// handshake, the hangup signal and the "session is ending" warning all ride
// it. RTC is the media plane and is empty for CHAT, so a chat token can never
// be used to open a video channel.
//
// One struct rather than two, because a separate RTC shape would duplicate
// the app id, the channel and both expiry fields, and would raise the
// question of which expiry wins — when the whole point is that one renew
// call refreshes both tokens at once.
type AgoraCredentials struct {
	AppID       string `json:"app_id"`
	ChannelName string `json:"channel_name"`

	// The account this token authenticates, and the account of the other
	// party. Both apps address each other by these strings.
	RTMAccount     string `json:"rtm_account"`
	RTMToken       string `json:"rtm_token"`
	PeerRTMAccount string `json:"peer_rtm_account"`

	// AUDIO and VIDEO only. Absent on a chat session.
	RTCToken   string `json:"rtc_token,omitempty"`
	RTCUID     uint32 `json:"rtc_uid,omitempty"`
	PeerRTCUID uint32 `json:"peer_rtc_uid,omitempty"`
	RTCRole    string `json:"rtc_role,omitempty"`

	ExpiresAt        string `json:"expires_at"`
	ExpiresAtUnix    int64  `json:"expires_at_unix"`
	ExpiresInSeconds int    `json:"expires_in_seconds"`
}
