import { lotteryRequest } from "@/lib/lottery-http";

export type PlayerAuthLoginPayload = {
  site_code?: string;
  username: string;
  password: string;
};

export type PlayerAuthLoginData = {
  access_token: string;
  expires_in: number;
  token_type: string;
  player: {
    id: number;
    site_code: string;
    username: string | null;
    nickname: string | null;
    funding_mode: string;
    auth_source: string;
  };
};

/** `POST /api/v1/player/auth/login`（公开） */
export function postPlayerAuthLogin(body: PlayerAuthLoginPayload): Promise<PlayerAuthLoginData> {
  return lotteryRequest.post<PlayerAuthLoginData>(`/player/auth/login`, body);
}
