# -*- coding: utf-8 -*-
# Copyright 2024-2025 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Claim Assistant product family.

from odoo import models, fields


class ResCompany(models.Model):
    _inherit = 'res.company'

    # Store/Location Information
    x_fc_store_address_1 = fields.Char(
        string='Store Address Line 1',
        help='First store/location address for reports (e.g., "Main Store - 123 Street, City, Province, Postal")',
    )
    x_fc_store_address_2 = fields.Char(
        string='Store Address Line 2',
        help='Second store/location address for reports (optional)',
    )
    x_fc_company_tagline = fields.Char(
        string='Company Tagline',
        help='Company tagline/slogan for reports (e.g., "Enhancing Accessibility, Improving Lives.")',
    )

    # Payment Information
    x_fc_etransfer_email = fields.Char(
        string='E-Transfer Email',
        help='Email address for Interac e-Transfers',
    )
    x_fc_cheque_payable_to = fields.Char(
        string='Cheque Payable To',
        help='Name for cheque payments (defaults to company name if empty)',
    )
    x_fc_payment_terms_html = fields.Html(
        string='Payment Terms',
        help='Payment terms and conditions displayed on reports (supports HTML formatting)',
        sanitize=True,
        sanitize_overridable=True,
    )

    # Refund Policy
    x_fc_include_refund_page = fields.Boolean(
        string='Include Refund Policy Page',
        default=True,
        help='Include a separate refund policy page at the end of reports',
    )
    x_fc_refund_policy_html = fields.Html(
        string='Refund Policy',
        help='Full refund policy displayed on a separate page (supports HTML formatting)',
        sanitize=True,
        sanitize_overridable=True,
    )

    # Office Notification Recipients
    x_fc_office_notification_ids = fields.Many2many(
        'res.partner',
        'fc_company_office_notification_partners_rel',
        'company_id',
        'partner_id',
        string='Office Notification Recipients',
        help='Contacts who will receive a copy (CC) of all automated ADP notifications',
    )

    def _get_cheque_payable_name(self):
        """Get the name for cheque payments, defaulting to company name."""
        self.ensure_one()
        return self.x_fc_cheque_payable_to or self.name

