odoo.define("pos_cashdro_refund.PasswordInputPopup", function (require) {
    "use strict";
    /* Copyright 2026 Criptomart - extracted from pos_payment_method_cashdro
       License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */

    const AbstractAwaitablePopup = require("point_of_sale.AbstractAwaitablePopup");
    const Registries = require("point_of_sale.Registries");
    const {_lt} = require("@web/core/l10n/translation");
    const {onMounted, useRef, useState} = owl;

    class PasswordInputPopup extends AbstractAwaitablePopup {
        setup() {
            super.setup();
            this.state = useState({inputValue: this.props.startingValue});
            this.inputRef = useRef("input");
            onMounted(this.onMounted);
        }
        onMounted() {
            this.inputRef.el.focus();
        }
        getPayload() {
            return this.state.inputValue;
        }
    }
    PasswordInputPopup.template = "PasswordInputPopup";
    PasswordInputPopup.defaultProps = {
        confirmText: _lt("Ok"),
        cancelText: _lt("Cancel"),
        title: "",
        body: "",
        startingValue: "",
        placeholder: "",
    };

    Registries.Component.add(PasswordInputPopup);

    return PasswordInputPopup;
});
