use std::sync::Arc;

use axum::{
    routing::{delete, get, post, put},
    Json, Router,
};

use crate::models::error::ApiResult;
use crate::AppState;

pub fn router() -> Router<Arc<AppState>> {
    Router::new()
        .route("/config", get(get_store_config))
        .route("/config", put(update_store_config))
        .route("/categories", get(list_categories))
        .route("/categories", post(create_category))
        .route("/categories/{id}", put(update_category))
        .route("/categories/{id}", delete(delete_category))
        .route("/items", get(list_items))
        .route("/items", post(create_item))
        .route("/items/{id}", put(update_item))
        .route("/items/{id}", delete(delete_item))
        .route("/transactions", get(list_transactions))
        .route("/webhook/paypal", post(paypal_webhook))
}

async fn get_store_config() -> ApiResult<Json<serde_json::Value>> {
    Ok(Json(serde_json::json!({"status": "not_implemented"})))
}

async fn update_store_config() -> ApiResult<Json<serde_json::Value>> {
    Ok(Json(serde_json::json!({"status": "not_implemented"})))
}

async fn list_categories() -> ApiResult<Json<serde_json::Value>> {
    Ok(Json(serde_json::json!({"status": "not_implemented"})))
}

async fn create_category() -> ApiResult<Json<serde_json::Value>> {
    Ok(Json(serde_json::json!({"status": "not_implemented"})))
}

async fn update_category() -> ApiResult<Json<serde_json::Value>> {
    Ok(Json(serde_json::json!({"status": "not_implemented"})))
}

async fn delete_category() -> ApiResult<Json<serde_json::Value>> {
    Ok(Json(serde_json::json!({"status": "not_implemented"})))
}

async fn list_items() -> ApiResult<Json<serde_json::Value>> {
    Ok(Json(serde_json::json!({"status": "not_implemented"})))
}

async fn create_item() -> ApiResult<Json<serde_json::Value>> {
    Ok(Json(serde_json::json!({"status": "not_implemented"})))
}

async fn update_item() -> ApiResult<Json<serde_json::Value>> {
    Ok(Json(serde_json::json!({"status": "not_implemented"})))
}

async fn delete_item() -> ApiResult<Json<serde_json::Value>> {
    Ok(Json(serde_json::json!({"status": "not_implemented"})))
}

async fn list_transactions() -> ApiResult<Json<serde_json::Value>> {
    Ok(Json(serde_json::json!({"status": "not_implemented"})))
}

async fn paypal_webhook() -> ApiResult<Json<serde_json::Value>> {
    Ok(Json(serde_json::json!({"status": "not_implemented"})))
}
