import { Host, h } from "@stencil/core";
import { businessServiceReceivedOptions, recurringPaymentsOptions, seasonalBusinessOptions } from "../../utils/business-form-options";
import { CURRENCY_MASK } from "../../../../utils/form-input-masks";
import { heading2 } from "../../../../styles/parts";
export class AdditionalQuestions {
    constructor() {
        this.errors = {};
        this.additional_questions = {};
        this.inputHandler = this.inputHandler.bind(this);
    }
    componentDidLoad() {
        this.formController.errors.subscribe(errors => (this.errors = Object.assign({}, errors)));
        this.formController.values.subscribe(values => (this.additional_questions = Object.assign({}, values.additional_questions)));
    }
    inputHandler(name, value) {
        this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { additional_questions: Object.assign(Object.assign({}, this.formController.values.getValue().additional_questions), { [name]: value }) }));
    }
    render() {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
        const additionalQuestionsDefaultValue = this.formController.getInitialValues().additional_questions;
        return (h(Host, { key: '05b69febfcd1e3901109c2cf64d812ff766b81cc' }, h("fieldset", { key: '84f06779dff94622fc7d14fdca53efb84f11e8cd' }, h("legend", { key: '3079e5d172c833d8172660f2f66b4d9637bfdb21', part: heading2 }, "Additional Questions"), h("div", { key: 'cf5155033143279316822237a84a0ad5e292a6cd', class: "row gy-3" }, h("div", { key: 'e28450dacb0d7040d62a4820c0252d95792d7e87', class: "col-12 col-md-6" }, h("form-control-monetary-provisioning", { key: 'e2ac8f211ffd9848fab123bc7826fd9f18e109a8', name: "business_revenue", label: "What is the business' estimated annual revenue from its primary business activities?", inputHandler: this.inputHandler, errorText: (_b = (_a = this.errors) === null || _a === void 0 ? void 0 : _a.additional_questions) === null || _b === void 0 ? void 0 : _b.business_revenue, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_revenue, maskOptions: CURRENCY_MASK.WHOLE })), h("div", { key: 'c5de85cd5e7b1501a0667a49d8d4826971e93052', class: "col-12 col-md-6" }, h("form-control-monetary-provisioning", { key: '3da3805e4ddbc633f060d36487b46e76e4f6eb04', name: "business_payment_volume", label: "What is the business' annual credit card & ACH volume anticipated to process?", inputHandler: this.inputHandler, errorText: (_d = (_c = this.errors) === null || _c === void 0 ? void 0 : _c.additional_questions) === null || _d === void 0 ? void 0 : _d.business_payment_volume, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_payment_volume, maskOptions: CURRENCY_MASK.WHOLE })), h("div", { key: 'ad62fecba837464fddba48273635bc8ae3a7d7ed', class: "col-12" }, h("form-control-select", { key: '9f09093b45c1c8eeb63065402f4b15e31c166d51', name: 'business_when_service_received', label: 'On average, how long after paying will your customers typically receive their goods or services?', inputHandler: this.inputHandler, errorText: (_f = (_e = this.errors) === null || _e === void 0 ? void 0 : _e.additional_questions) === null || _f === void 0 ? void 0 : _f.business_when_service_received, options: businessServiceReceivedOptions, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_when_service_received })), h("div", { key: 'e2a05cbb74138a554033817e3bb1372933e64b99', class: "col-12" }, h("form-control-select", { key: '8a95d74c02f2cf662f6cf0658faeae1a1a8f6a11', name: 'business_recurring_payments', label: 'Does your business offer recurring payments?', inputHandler: this.inputHandler, errorText: (_h = (_g = this.errors) === null || _g === void 0 ? void 0 : _g.additional_questions) === null || _h === void 0 ? void 0 : _h.business_recurring_payments, options: recurringPaymentsOptions, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_recurring_payments })), h("div", { key: '8d94059b0966237c980b1c1622e1ed3fd5bd8a58', class: "col-12" }, h("form-control-text", { key: '320fa784aef300393ddfcca4f2ef4798d207bf30', name: 'business_recurring_payments_percentage', label: 'What percent of revenue is generated from each recurring payment type offered?', inputHandler: this.inputHandler, errorText: (_k = (_j = this.errors) === null || _j === void 0 ? void 0 : _j.additional_questions) === null || _k === void 0 ? void 0 : _k.business_recurring_payments_percentage, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_recurring_payments_percentage })), h("div", { key: '8525c21ec91e652737455e7b093ff280800d97c2', class: "col-12" }, h("form-control-select", { key: 'c2cba23606b03f758ba704c074a65a212e111998', name: 'business_seasonal', label: 'Is this business seasonal?', inputHandler: this.inputHandler, errorText: (_m = (_l = this.errors) === null || _l === void 0 ? void 0 : _l.additional_questions) === null || _m === void 0 ? void 0 : _m.business_seasonal, options: seasonalBusinessOptions, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_seasonal })), h("div", { key: 'c047c43284fbe92952c487544bc8206c98433edc', class: "col-12" }, h("form-control-text", { key: '27348b1899f8b8f7f18a0618aa4dcb812a3bef04', name: 'business_other_payment_details', label: 'Is there anything else you would like us to know about how your customers pay the business?', inputHandler: this.inputHandler, errorText: (_p = (_o = this.errors) === null || _o === void 0 ? void 0 : _o.additional_questions) === null || _p === void 0 ? void 0 : _p.business_other_payment_details, defaultValue: additionalQuestionsDefaultValue === null || additionalQuestionsDefaultValue === void 0 ? void 0 : additionalQuestionsDefaultValue.business_other_payment_details }))))));
    }
    static get is() { return "additional-questions"; }
    static get properties() {
        return {
            "formController": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "FormController",
                    "resolved": "FormController",
                    "references": {
                        "FormController": {
                            "location": "import",
                            "path": "../../../../components",
                            "id": "src/components.d.ts::FormController"
                        }
                    }
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false
            }
        };
    }
    static get states() {
        return {
            "errors": {},
            "additional_questions": {}
        };
    }
}
