# -*- coding: utf-8 -*-
# Copyright 2024-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'

    # Google Maps API Settings
    fc_google_maps_api_key = fields.Char(
        string='Google Maps API Key',
        config_parameter='fusion_claims.google_maps_api_key',
        help='API key for Google Maps Places autocomplete in address fields',
    )
    fc_google_review_url = fields.Char(
        related='company_id.x_fc_google_review_url',
        readonly=False,
        string='Google Review URL',
    )

    # Technician Management
    fc_store_open_hour = fields.Float(
        string='Store Open Time',
        config_parameter='fusion_claims.store_open_hour',
        help='Store opening time for technician scheduling (e.g. 9.0 = 9:00 AM)',
    )
    fc_store_close_hour = fields.Float(
        string='Store Close Time',
        config_parameter='fusion_claims.store_close_hour',
        help='Store closing time for technician scheduling (e.g. 18.0 = 6:00 PM)',
    )
    fc_google_distance_matrix_enabled = fields.Boolean(
        string='Enable Distance Matrix',
        config_parameter='fusion_claims.google_distance_matrix_enabled',
        help='Enable Google Distance Matrix API for travel time calculations between technician tasks',
    )
    fc_technician_start_address = fields.Char(
        string='Technician Start Address',
        config_parameter='fusion_claims.technician_start_address',
        help='Default start location for technician travel calculations (e.g. warehouse/office address)',
    )
    fc_location_retention_days = fields.Char(
        string='Location History Retention (Days)',
        config_parameter='fusion_claims.location_retention_days',
        help='How many days to keep technician location history. '
             'Leave empty = 30 days (1 month). '
             '0 = delete at end of each day. '
             '1+ = keep for that many days.',
    )

    # Web Push Notifications
    fc_push_enabled = fields.Boolean(
        string='Enable Push Notifications',
        config_parameter='fusion_claims.push_enabled',
        help='Enable web push notifications for technician tasks',
    )
    fc_vapid_public_key = fields.Char(
        string='VAPID Public Key',
        config_parameter='fusion_claims.vapid_public_key',
        help='Public key for Web Push VAPID authentication (auto-generated)',
    )
    fc_vapid_private_key = fields.Char(
        string='VAPID Private Key',
        config_parameter='fusion_claims.vapid_private_key',
        help='Private key for Web Push VAPID authentication (auto-generated)',
    )
    fc_push_advance_minutes = fields.Integer(
        string='Notification Advance (min)',
        config_parameter='fusion_claims.push_advance_minutes',
        help='Send push notifications this many minutes before a scheduled task',
    )
