// =============================================================================
// TudadaSDK GameAction Types
//
// 게임 액션 로깅 API 타입 정의 (USER_EVENT(GAME_ACTION) fire-and-forget)
// =============================================================================

using System;

namespace Tudada
{
    /// <summary>
    /// 1판 종료 결과 (COMPLETE_PLAY 의 result 필드)
    /// </summary>
    public static class GameActionResult
    {
        public const string Win = "WIN";
        public const string Lose = "LOSE";
        public const string Draw = "DRAW";
        public const string Done = "DONE";
    }

    /// <summary>
    /// 비정상 종료 사유 (EXIT_PLAY 의 reason 필드)
    /// </summary>
    public static class GameActionExitReason
    {
        public const string Timeout = "TIMEOUT";
        public const string Abandoned = "ABANDONED";
    }

    /// <summary>
    /// START_PLAY payload (모두 선택)
    /// </summary>
    [Serializable]
    public class GameActionStartPayload
    {
        public int round;
        public int stage;
        public int level;

        /// <summary>각 필드 사용 여부 (0/null 구분용)</summary>
        public bool hasRound;
        public bool hasStage;
        public bool hasLevel;
    }

    /// <summary>
    /// COMPLETE_PLAY payload (result, playTime 필수)
    /// </summary>
    [Serializable]
    public class GameActionCompletePayload
    {
        /// <summary>"WIN" | "LOSE" | "DRAW" | "DONE" — <see cref="GameActionResult"/> 상수 사용 권장</summary>
        public string result;

        /// <summary>1판 진행 시간 (ms)</summary>
        public long playTime;

        public int score;
        public int round;
        public int stage;
        public int level;

        public bool hasScore;
        public bool hasRound;
        public bool hasStage;
        public bool hasLevel;
    }

    /// <summary>
    /// EXIT_PLAY payload (playTime, reason 필수)
    /// </summary>
    [Serializable]
    public class GameActionExitPayload
    {
        /// <summary>1판 진행 시간 (ms)</summary>
        public long playTime;

        /// <summary>"TIMEOUT" | "ABANDONED" — <see cref="GameActionExitReason"/> 상수 사용 권장</summary>
        public string reason;
    }
}
