import request from '@/utils/http'
export interface ModelRequest{id:string;user_login:string;provider_code:string;model:string;reason:string;requested_rpm:number;requested_monthly_tokens:number;status:string;decision_note:string;created_at:string}
export const fetchModelRequests=(status='')=>request.get<ModelRequest[]>({url:'/api/v1/admin/model-requests',params:{status}})
export const decideModelRequest=(id:string,status:'approve'|'reject',note:string)=>request.post<ModelRequest>({url:`/api/v1/admin/model-requests/${id}/${status}`,params:{note}})
export interface FactSettings{provider_id?:string;provider_code:string;model:string;timeout_seconds:number;updated_at?:string}
export interface FactPolicy{id?:string;scope:string;enabled:boolean;mode:'async'|'sync';action:'observe'|'annotate'|'block';knowledge_base_ids:string[];support_threshold:number;evidence_threshold:number;top_k:number;max_claims:number;revision?:number}
export interface FactEvent{id:string;request_id:string;model:string;mode:string;action:string;verdict:string;support_score?:number;latency_ms:number;error:string;created_at:string}
export const fetchFactSettings=()=>request.get<FactSettings>({url:'/api/v1/admin/fact-check/settings'})
export const saveFactSettings=(params:FactSettings)=>request.put<FactSettings>({url:'/api/v1/admin/fact-check/settings',params})
export const fetchFactPolicies=()=>request.get<{items:FactPolicy[]}>({url:'/api/v1/admin/fact-check/policies'})
export const createFactPolicy=(params:FactPolicy)=>request.post<FactPolicy>({url:'/api/v1/admin/fact-check/policies',params})
export const updateFactPolicy=(id:string,params:FactPolicy)=>request.put<FactPolicy>({url:`/api/v1/admin/fact-check/policies/${id}`,params})
export const deleteFactPolicy=(id:string)=>request.del({url:`/api/v1/admin/fact-check/policies/${id}`})
export const fetchFactEvents=()=>request.get<{items:FactEvent[]}>({url:'/api/v1/admin/fact-check/events'})

