package com.omixlab.lckcontrol.data.remote

import com.squareup.moshi.JsonClass

// ── Health ───────────────────────────────────────────────

@JsonClass(generateAdapter = true)
data class HealthResponse(
    val status: String,
    val timestamp: String,
    val version: String? = null,
)

// ── Auth ─────────────────────────────────────────────────

@JsonClass(generateAdapter = true)
data class MetaCallbackRequest(
    val userId: String,
    val nonce: String,
    val deviceInfo: String? = null,
)

@JsonClass(generateAdapter = true)
data class RefreshRequest(
    val refreshToken: String,
)

@JsonClass(generateAdapter = true)
data class AuthTokensResponse(
    val accessToken: String,
    val refreshToken: String,
    val expiresIn: Int,
)

@JsonClass(generateAdapter = true)
data class UserProfileResponse(
    val id: String,
    val displayName: String,
    val email: String?,
    val avatarUrl: String?,
)

// ── Providers ────────────────────────────────────────────

@JsonClass(generateAdapter = true)
data class AuthUrlResponse(
    val url: String,
    val state: String,
)

@JsonClass(generateAdapter = true)
data class ProviderCallbackRequest(
    val code: String,
    val state: String,
)

@JsonClass(generateAdapter = true)
data class LinkedAccountResponse(
    val id: String,
    val serviceId: String,
    val displayName: String,
    val accountId: String,
    val avatarUrl: String?,
    val rtmpUrl: String? = null,
    val streamKey: String? = null,
)

@JsonClass(generateAdapter = true)
data class CreateCustomRtmpRequest(
    val displayName: String,
    val rtmpUrl: String,
    val streamKey: String,
)

// ── Streams ──────────────────────────────────────────────

@JsonClass(generateAdapter = true)
data class CreateStreamPlanRequest(
    val name: String,
    val executionMode: String? = null,
    val gameId: String? = null,
    val destinations: List<CreateDestinationRequest>,
)

@JsonClass(generateAdapter = true)
data class UpdateStreamPlanRequest(
    val name: String? = null,
    val executionMode: String? = null,
    val gameId: String? = null,
    val destinations: List<CreateDestinationRequest>? = null,
)

@JsonClass(generateAdapter = true)
data class CreateDestinationRequest(
    val linkedAccountId: String? = null,
    val title: String,
    val description: String? = null,
    val privacyStatus: String? = null,
    val gameId: String? = null,
    val tags: String? = null,
    val rtmpUrl: String? = null,
    val streamKey: String? = null,
)

@JsonClass(generateAdapter = true)
data class StreamPlanResponse(
    val id: String,
    val name: String,
    val status: String,
    val executionMode: String? = null,
    val gameId: String? = null,
    val createdAt: String,
    val updatedAt: String,
    val destinations: List<StreamDestinationResponse>,
)

@JsonClass(generateAdapter = true)
data class StreamDestinationResponse(
    val id: String,
    val serviceId: String,
    val linkedAccountId: String,
    val title: String,
    val description: String,
    val privacyStatus: String,
    val gameId: String,
    val tags: String,
    val rtmpUrl: String,
    val streamKey: String,
    val broadcastId: String,
    val status: String,
)

@JsonClass(generateAdapter = true)
data class PrepareResponse(
    val planId: String,
    val destinations: List<PreparedDestination>,
)

@JsonClass(generateAdapter = true)
data class PreparedDestination(
    val id: String,
    val serviceId: String,
    val rtmpUrl: String,
    val streamKey: String,
    val broadcastId: String,
)

@JsonClass(generateAdapter = true)
data class SuccessResponse(
    val success: Boolean,
)

@JsonClass(generateAdapter = true)
data class StatusResponse(
    val success: Boolean,
    val status: String,
)

@JsonClass(generateAdapter = true)
data class ErrorResponse(
    val error: String,
)
