from odoo import api, fields, models


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

    rental_google_review_url = fields.Char(
        string="Google Review URL",
        config_parameter='fusion_rental.google_review_url',
        help="Google Review link shown in thank-you emails after rental close. "
             "For multi-location, set per warehouse in Inventory > Configuration > Warehouses.",
    )
    rental_deposit_hold_days = fields.Integer(
        string="Deposit Hold Period (Days)",
        config_parameter='fusion_rental.deposit_hold_days',
        default=3,
        help="Number of days to hold the security deposit after pickup before "
             "processing the refund. Default is 3 days.",
    )
    rental_google_maps_api_key = fields.Char(
        string="Google Maps API Key",
        config_parameter='fusion_rental.google_maps_api_key',
        help="API key for Google Places address autocomplete on the rental "
             "agreement form. If Fusion Claims is installed, its API key is "
             "used automatically and this field can be left blank.",
    )

    rental_marketing_email_pct = fields.Integer(
        string="Marketing Email Timing (%)",
        config_parameter='fusion_rental.marketing_email_pct',
        default=23,
        help="Percentage of rental period after which the purchase marketing "
             "email is sent. Default 23% (7 days on a 30-day rental). "
             "Minimum effective offset is 1 day.",
    )
    rental_renewal_reminder_pct = fields.Integer(
        string="Renewal Reminder Timing (%)",
        config_parameter='fusion_rental.renewal_reminder_pct',
        default=10,
        help="Percentage of rental period before renewal date at which the "
             "reminder is sent. Default 10% (3 days on a 30-day rental). "
             "Minimum effective offset is 1 day.",
    )
    rental_short_term_threshold_days = fields.Integer(
        string="Short-Term Threshold (Days)",
        config_parameter='fusion_rental.short_term_threshold_days',
        default=3,
        help="Rentals shorter than this duration (in days) are treated as "
             "short-term. Auto-renewal is delayed until the return window "
             "plus grace period has passed.",
    )
    rental_short_term_grace_hours = fields.Integer(
        string="Short-Term Grace Period (Hours)",
        config_parameter='fusion_rental.short_term_grace_hours',
        default=1,
        help="Hours after the scheduled return time before auto-renewal "
             "kicks in for short-term rentals. Gives the customer time to "
             "return without being charged.",
    )
    rental_short_term_reminder_hours = fields.Integer(
        string="Short-Term Reminder (Hours Before Return)",
        config_parameter='fusion_rental.short_term_reminder_hours',
        default=2,
        help="For short-term rentals, send the renewal reminder this many "
             "hours before the scheduled return time. Default is 2 hours.",
    )
