import request from '@/utils/http'

export interface ContentRule { name: string; pattern: string; replacement: string }
export interface ContentPolicy {
  id: string; name: string; description: string; action: 'audit' | 'block' | 'redact'; priority: number
  paths: string[]; models: string[]; api_key_ids: string[]; rules: ContentRule[]; enabled: boolean; revision: number
}
export type ContentPolicyInput = Omit<ContentPolicy, 'id' | 'revision'>
export const fetchContentPolicies = () => request.get<ContentPolicy[]>({ url: '/api/v1/admin/content-policies' })
export const createContentPolicy = (data: ContentPolicyInput) => request.post<ContentPolicy>({ url: '/api/v1/admin/content-policies', params: data })
export const updateContentPolicy = (id: string, data: ContentPolicyInput) => request.put<ContentPolicy>({ url: `/api/v1/admin/content-policies/${id}`, params: data })
export const deleteContentPolicy = (id: string) => request.del({ url: `/api/v1/admin/content-policies/${id}` })
