/**
 * Opening Screen Presets API client
 * @since 1.1.0
 */

import { apiClient } from './client'

export interface OpeningScreenPreset {
    id: number
    name: string
    slug: string
    description: string | null
    is_default: number
    is_system: number
    mode: 'questions_ai' | 'questions_answers' | 'departments'
    welcome_text: string | null
    show_welcome: number
    questions: Array<{ text: string; icon: string }>
    ai_instructions: string | null
    qa_pairs: Array<{ question: string; answer: string; icon: string }>
    contact_list_id: number | null
    show_departments: number
    show_contact_cards: number
    attached_files: Array<{ name: string; type: string }>
    language?: string
}

export interface OpeningScreenPresetsResponse {
    success: boolean
    data: {
        presets: OpeningScreenPreset[]
        modes: Record<string, string>
    }
}

export const openingScreenPresetsApi = {
    /**
     * Get all opening screen presets
     * @param language Optional language code to filter presets
     */
    async getPresets(language?: string): Promise<OpeningScreenPresetsResponse> {
        return apiClient.get<OpeningScreenPresetsResponse>('opening-screen-presets', { language })
    },
}
