//! Match management handlers

use axum::{
    extract::{State, Path, Query},
    response::Html,
    http::StatusCode,
};
use sqlx::SqlitePool;
use serde::Deserialize;

#[derive(Clone)]
pub struct AppState {
    pub pool: SqlitePool,
}

#[derive(Deserialize)]
pub struct BalanceQuery {
    pub p1: Option<i64>,
    pub p2: Option<i64>,
    pub p3: Option<i64>,
    pub p4: Option<i64>,
}

pub async fn match_history_handler(State(_state): State<AppState>) -> Html<String> {
    Html("<h1>Match History</h1>".to_string())
}

pub async fn new_match_handler(State(_state): State<AppState>) -> Html<String> {
    Html("<h1>New Match Form</h1>".to_string())
}

pub async fn create_match_handler(State(_state): State<AppState>) -> Html<String> {
    Html("<h1>Match Created</h1>".to_string())
}

pub async fn delete_match_handler(
    State(_state): State<AppState>,
    Path(_match_id): Path<i64>,
) -> Result<Html<String>, (StatusCode, String)> {
    Ok(Html("<h1>Match Deleted</h1>".to_string()))
}

pub async fn balance_query_handler(
    State(_state): State<AppState>,
    Query(_params): Query<BalanceQuery>,
) -> Result<Html<String>, (StatusCode, String)> {
    Ok(Html("<h1>Balance Query</h1>".to_string()))
}
