# -*- 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'

    fusion_api_global_budget = fields.Float(
        string='Global Monthly Budget (USD)',
        config_parameter='fusion_api.global_monthly_budget_usd',
        default=0.0,
        help="Global monthly budget across all providers. 0 = unlimited.",
    )
    fusion_api_default_environment = fields.Selection([
        ('production', 'Production'),
        ('sandbox', 'Sandbox'),
    ], string='Default Environment',
        config_parameter='fusion_api.default_environment',
        default='production',
    )
    fusion_api_log_retention_days = fields.Integer(
        string='Usage Log Retention (days)',
        config_parameter='fusion_api.log_retention_days',
        default=90,
        help="Keep detailed usage logs for this many days. "
             "Daily summaries are kept indefinitely. 0 = keep forever.",
    )
    fusion_api_auto_detect = fields.Boolean(
        string='Auto-Detect Consumers',
        config_parameter='fusion_api.auto_detect_consumers',
        default=True,
        help="Automatically register new Fusion modules when they first call the API.",
    )
