summaryrefslogblamecommitdiff
path: root/makima/src/server/handlers/templates.rs
blob: aa97876bd1c5ab7adaa74d73f2684c67b6b8c042 (plain) (tree)
1
2
3
4
5
6
7
8
9
                               
                                                                          
 
           



                           
                     


                          

                                                
                                                                                
                                          








                                                                                
                                                              







                                                                                                               


                                                                  





                                                           
//! Contract types API handler.
//! Only returns built-in contract types (simple, specification, execute).

use axum::{
    http::StatusCode,
    response::IntoResponse,
    Json,
};
use serde::Serialize;
use utoipa::ToSchema;

use crate::llm::templates;
use crate::llm::templates::ContractTypeTemplate;

// =============================================================================
// Contract Type Templates (Built-in Only)
// =============================================================================

/// Response for listing contract types
#[derive(Debug, Serialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ListContractTypesResponse {
    pub contract_types: Vec<ContractTypeTemplate>,
}

/// List all available contract type templates (built-in only)
#[utoipa::path(
    get,
    path = "/api/v1/contract-types",
    responses(
        (status = 200, description = "Contract types retrieved successfully", body = ListContractTypesResponse)
    ),
    tag = "templates"
)]
pub async fn list_contract_types() -> impl IntoResponse {
    // Only return built-in types (simple, specification, execute)
    let contract_types = templates::all_contract_types();
    (
        StatusCode::OK,
        Json(ListContractTypesResponse { contract_types }),
    )
        .into_response()
}