mod analysis;
mod companies;
mod configs;
mod market_data;
mod system;
use crate::AppState;
use axum::{
    routing::{get, post},
    Router,
};

pub fn create_router(_state: AppState) -> Router<AppState> {
    let router: Router<AppState> = Router::new()
        // System
        .route("/health", get(system::get_health))
        // Configs
        .route(
            "/configs/llm_providers",
            get(configs::get_llm_providers_config).put(configs::update_llm_providers_config),
        )
        .route(
            "/configs/analysis_template_sets",
            get(configs::get_analysis_template_sets).put(configs::update_analysis_template_sets),
        )
        .route(
            "/configs/data_sources",
            get(configs::get_data_sources_config).put(configs::update_data_sources_config),
        )
        // Companies
        .route("/companies/{symbol}", get(companies::get_company_by_symbol))
        // Market Data
        .route(
            "/market-data/financial-statements/{symbol}",
            get(market_data::get_financials_by_symbol),
        )
        // Analysis Results
        .route(
            "/analysis-results",
            post(analysis::create_analysis_result).get(analysis::get_analysis_results),
        )
        .route(
            "/analysis-results/:id",
            get(analysis::get_analysis_result_by_id),
        );

    router
}
