from odoo import models, fields


class PosConfigLaundryExt(models.Model):
    """Laundry POS settings — dedicated section in POS configuration.

    All defaults are intentionally conservative: feature OFF until the
    operator opts in. When `enable_laundry_order_type` is False the
    popups are skipped entirely — existing POS flow is unchanged.
    """
    _inherit = 'pos.config'

    # ── Order-type / attribute / delivery flow ────────────────────────
    enable_laundry_order_type = fields.Boolean(
        string='Ask Laundry Order Type in POS',
        default=False,
    )
    require_laundry_order_type = fields.Boolean(
        string='Order Type Required',
        default=False,
    )
    ask_laundry_order_type_on_first_line = fields.Boolean(
        string='Ask on First Laundry Line',
        default=True,
    )
    allow_change_laundry_order_type_before_payment = fields.Boolean(
        string='Allow Change Before Payment',
        default=True,
    )
    default_laundry_order_type_id = fields.Many2one(
        'laundry.order.type',
        string='Default Order Type',
    )
    enable_laundry_attributes = fields.Boolean(
        string='Enable Order Attributes',
        default=True,
    )
    require_delivery_details_if_needed = fields.Boolean(
        string='Require Delivery Details',
        default=True,
        help='Prompt for delivery address / scheduled time when the selected '
             'type or attributes flag this as a delivery order.',
    )
    require_delivery_time = fields.Boolean(
        string='Require Delivery Time',
        default=False,
        help='When enabled, the delivery details popup enforces a scheduled '
             'time before it can be confirmed. When disabled, cashiers may '
             'skip the time field and the order is saved without one.',
    )
    show_order_type_icons = fields.Boolean(
        string='Show Icons in POS',
        default=True,
    )
