# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)

from odoo import models, fields


class ResConfigSettings(models.TransientModel):
    _inherit = 'res.config.settings'

    fclk_ai_openai_api_key = fields.Char(
        string='OpenAI API Key',
        config_parameter='fusion_clock_ai.openai_api_key',
    )
    fclk_ai_openai_model = fields.Selection([
        ('gpt-4o', 'GPT-4o (Best quality, higher cost)'),
        ('gpt-4o-mini', 'GPT-4o Mini (Good quality, low cost)'),
        ('gpt-3.5-turbo', 'GPT-3.5 Turbo (Basic, lowest cost)'),
    ], string='AI Model',
        config_parameter='fusion_clock_ai.openai_model',
        default='gpt-4o-mini',
    )
    fclk_ai_max_response_tokens = fields.Integer(
        string='Max Response Tokens',
        config_parameter='fusion_clock_ai.max_response_tokens',
        default=1024,
    )
    fclk_ai_monthly_budget_usd = fields.Float(
        string='Monthly Budget (USD)',
        config_parameter='fusion_clock_ai.monthly_budget_usd',
        default=50.0,
        help="Set to 0 for unlimited. AI requests stop when budget is reached.",
    )
    fclk_ai_cache_ttl_minutes = fields.Integer(
        string='Cache TTL (minutes)',
        config_parameter='fusion_clock_ai.cache_ttl_minutes',
        default=15,
    )
    fclk_ai_enable_manager_chat = fields.Boolean(
        string='Enable Manager AI Chat',
        config_parameter='fusion_clock_ai.enable_manager_chat',
        default=True,
    )
    fclk_ai_enable_employee_chat = fields.Boolean(
        string='Enable Employee AI Assistant',
        config_parameter='fusion_clock_ai.enable_employee_chat',
        default=True,
    )
    fclk_ai_enable_narrative_reports = fields.Boolean(
        string='Enable AI Narrative Reports',
        config_parameter='fusion_clock_ai.enable_narrative_reports',
        default=True,
    )
    fclk_ai_enable_anomaly_detection = fields.Boolean(
        string='Enable Payroll Anomaly Detection',
        config_parameter='fusion_clock_ai.enable_anomaly_detection',
        default=True,
    )
    fclk_ai_enable_coach = fields.Boolean(
        string='Enable Attendance Coach',
        config_parameter='fusion_clock_ai.enable_coach',
        default=True,
    )
    fclk_ai_enable_correction_advisor = fields.Boolean(
        string='Enable Correction Review Advisor',
        config_parameter='fusion_clock_ai.enable_correction_advisor',
        default=True,
    )
    fclk_ai_enable_predictions = fields.Boolean(
        string='Enable Predictive Alerts',
        config_parameter='fusion_clock_ai.enable_predictions',
        default=False,
    )
    fclk_ai_enable_shift_suggestions = fields.Boolean(
        string='Enable Shift Optimization',
        config_parameter='fusion_clock_ai.enable_shift_suggestions',
        default=False,
    )
    fclk_ai_enable_compliance = fields.Boolean(
        string='Enable Compliance Checks',
        config_parameter='fusion_clock_ai.enable_compliance',
        default=False,
    )
    fclk_ai_enable_smart_config = fields.Boolean(
        string='Enable Natural Language Config',
        config_parameter='fusion_clock_ai.enable_smart_config',
        default=False,
    )
    fclk_ai_enable_geofence_tuning = fields.Boolean(
        string='Enable Geofence Tuning',
        config_parameter='fusion_clock_ai.enable_geofence_tuning',
        default=False,
    )
    fclk_ai_enable_incident_explain = fields.Boolean(
        string='Enable Incident Auto-Explain',
        config_parameter='fusion_clock_ai.enable_incident_explain',
        default=True,
    )
