from odoo import fields, models


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

    sapb1_base_url = fields.Char(
        string="SAP B1 Service Layer URL",
        config_parameter="sapb1.base_url",
        help="e.g. https://192.168.68.16:50000/b1s/v1",
    )
    sapb1_company_db = fields.Char(
        string="SAP B1 Company DB", config_parameter="sapb1.company_db",
    )
    sapb1_username = fields.Char(
        string="SAP B1 User", config_parameter="sapb1.username",
    )
    sapb1_password = fields.Char(
        string="SAP B1 Password", config_parameter="sapb1.password",
    )
    sapb1_verify_ssl = fields.Boolean(
        string="Verify SSL Certificate", config_parameter="sapb1.verify_ssl",
        help="Off for on-prem self-signed certificates on a trusted network.",
    )
    sapb1_production_company_db = fields.Char(
        string="Production Company DB", config_parameter="sapb1.production_company_db",
        help="Defaults to 'XEN' if left blank. Any write to this company DB "
             "is blocked unless 'Confirm production writes' is also checked.",
    )
    sapb1_confirm_production_writes = fields.Boolean(
        string="Confirm production writes", config_parameter="sapb1.confirm_production_writes",
        help="Leave OFF except when you deliberately intend to write to "
             "production SAP B1. While off, any push/absence-log write "
             "targeting the Production Company DB above is blocked, even "
             "if Company DB is accidentally set to it.",
    )
