// TriplePick 도메인 타입 — 백엔드 API 응답(schemas.py)과 정합.

export type Outcome = "TEAM_A_WIN" | "DRAW" | "TEAM_B_WIN";
export type ModelName = "GPT" | "Claude" | "Gemini";
export type MatchPhase = "scheduled" | "open" | "locked" | "live" | "finished";

export interface Team {
  name: string;
  shortName: string;
  code: string;
  flag: string;
}

export interface MatchResult {
  scoreA: number;
  scoreB: number;
  outcome: Outcome;
}

export interface AIPrediction {
  matchId: string;
  model: ModelName;
  outcome: Outcome;
  scoreA: number;
  scoreB: number;
  confidencePct: number;
  reasonShort: string;
  generatedAt: string;
}

export interface CrowdStats {
  matchId: string;
  total: number;
  teamAWin: number;
  draw: number;
  teamBWin: number;
}

export interface Match {
  matchId: string;
  roundLabel: string;
  group: string;
  teamA: Team;
  teamB: Team;
  kickoffKst: string;
  venue: string;
  opensAt: string;
  lockAt: string;
  status: string;
  phase: MatchPhase;
  votable: boolean;
  votingOpen: boolean;
  hookText: string;
  result?: MatchResult | null;
  predictions: AIPrediction[];
  crowd?: CrowdStats | null;
}

export interface UserPick {
  outcome: Outcome;
  scoreA: number;
  scoreB: number;
}

// 내 지난 예측 (이메일 기준, 로그인 없음) — GET /api/predictions/mine
export interface MyPrediction {
  matchId: string;
  teamA: Team;
  teamB: Team;
  kickoffKst: string;
  outcome: Outcome;
  scoreA: number;
  scoreB: number;
  submittedAt: string; // ISO — 최신순 정렬 기준
  result?: {
    scoreA: number;
    scoreB: number;
    outcome: Outcome;
    hitOutcome: boolean;
  } | null;
}

export interface Standing {
  rank: number;
  emailMasked: string;
  totalPoints: number;
  exactCount: number;
  matchesPlayed: number;
}

export interface Leaderboard {
  standings: Standing[];
  scoredMatches: number;
}

export interface Comment {
  nickname: string; // 축구 코믹 한국어 5글자 (서버가 기기 해시로 자동 배정)
  body: string;
  createdAt: string;
}

export interface CommentList {
  items: Comment[];
  total: number;
}
