import { c as create$3, a as create$6 } from './index.esm-KCSohgHx.js';
import { m as makeTaxIdValidation, d as dateOfIncorporationValidation, i as industryValidation, b as businessClassificationValidation, a as doingBusinessAsValidation, p as phoneValidation, e as emailValidation, w as websiteUrlValidation, c as businessNameValidation, t as taxIdValidation, o as otherPaymentDetailsValidation, f as whenServiceReceivedValidation, r as revenueValidation, g as paymentVolumeValidation, h as cityValidation, l as lineTwoValidation, j as lineOneValidation, k as makePostalValidation, n as ownershipPercentageValidation, s as ssnValidation, q as dobValidation, u as identityTitleValidation, v as identityNameValidation, x as makeIdentityNumberValidation } from './schema-validations-CHxw3FkH.js';
import { C as CountryCode } from './Business-BcNb9bVO.js';
import { c as countryLabels } from './country-config-CEJVOOGe.js';

// Base schema (no country-specific rules for classification/tax id)
const baseBusinessCoreInfoSchema = (allowOptionalFields) => {
    const schema = create$3({
        legal_name: businessNameValidation.required('Enter legal name'),
        website_url: websiteUrlValidation.required('Enter business website url'),
        email: emailValidation.required('Enter business email'),
        phone: phoneValidation.required('Enter phone number'),
        doing_business_as: doingBusinessAsValidation.nullable(),
        classification: businessClassificationValidation.required('Select business classification'),
        industry: industryValidation.required('Enter a business industry'),
        date_of_incorporation: dateOfIncorporationValidation.required('Enter date of registration'),
    });
    const easySchema = create$3({
        legal_name: businessNameValidation.required('Enter legal name'),
        website_url: websiteUrlValidation.nullable(),
        email: emailValidation.nullable(),
        phone: phoneValidation.nullable(),
        doing_business_as: doingBusinessAsValidation.nullable(),
        classification: businessClassificationValidation.nullable(),
        industry: industryValidation.nullable(),
        tax_id: taxIdValidation.nullable(),
        date_of_incorporation: dateOfIncorporationValidation.nullable(),
    });
    return allowOptionalFields ? easySchema : schema;
};
// Country-specific schema convenience wrappers
const businessCoreInfoSchemaUSA = (allowOptionalFields) => baseBusinessCoreInfoSchema(allowOptionalFields).concat(create$3({
    classification: create$6().required('Select business classification'),
    tax_id: makeTaxIdValidation(CountryCode.USA)
        .when('tax_id_last4', {
        is: (val) => !val,
        then: (schema) => schema.required(`Enter valid ${countryLabels.USA.taxIdLabel} without dashes`),
        otherwise: (schema) => schema.nullable(),
    }),
}));
const businessCoreInfoSchemaCAN = (allowOptionalFields) => baseBusinessCoreInfoSchema(allowOptionalFields).concat(create$3({
    classification: create$6().required('Select business classification'),
    tax_id: makeTaxIdValidation(CountryCode.CAN)
        .when('tax_id_last4', {
        is: (val) => !val,
        then: (schema) => schema.notRequired().nullable(),
        otherwise: (schema) => schema.nullable(),
    }),
}));

const additionalQuestionsSchema = (allowOptionalFields) => {
    const schema = create$3({
        business_revenue: revenueValidation.required('Enter business revenue'),
        business_payment_volume: paymentVolumeValidation.required('Enter business payment volume'),
        business_average_transaction_amount: revenueValidation.required('Enter average transaction amount'),
        business_when_service_received: whenServiceReceivedValidation.required('Select when service is received'),
        business_other_payment_details: otherPaymentDetailsValidation.nullable(),
    });
    const easySchema = create$3({
        business_revenue: revenueValidation.nullable(),
        business_payment_volume: paymentVolumeValidation.nullable(),
        business_average_transaction_amount: revenueValidation.nullable(),
        business_when_service_received: whenServiceReceivedValidation.nullable(),
        business_other_payment_details: otherPaymentDetailsValidation.nullable(),
    });
    return allowOptionalFields ? easySchema : schema;
};

// Internal USA schemas
const schemaUSA$1 = () => create$3({
    line1: lineOneValidation.nullable(),
    line2: lineTwoValidation.nullable(),
    city: cityValidation.nullable(),
    state: create$6().nullable(),
    postal_code: create$6().nullable(),
});
const strictSchemaUSA$1 = () => create$3({
    line1: lineOneValidation.required('Enter street address'),
    line2: lineTwoValidation.nullable(),
    city: cityValidation.required('Enter city'),
    state: create$6().required('Select state'),
    postal_code: makePostalValidation(CountryCode.USA).required('Enter postal code'),
});
// Internal CAN schemas
const schemaCAN$1 = () => create$3({
    line1: lineOneValidation.nullable(),
    line2: lineTwoValidation.nullable(),
    city: cityValidation.nullable(),
    state: create$6().nullable(),
    postal_code: create$6().nullable(),
});
const strictSchemaCAN$1 = () => create$3({
    line1: lineOneValidation.required('Enter street address'),
    line2: lineTwoValidation.nullable(),
    city: cityValidation.required('Enter city'),
    state: create$6().required('Select province or state'),
    postal_code: makePostalValidation(CountryCode.CAN).required('Enter postal code'),
});
// Public API
const addressSchemaUSA = (allowOptionalFields) => allowOptionalFields ? schemaUSA$1() : strictSchemaUSA$1();
const addressSchemaCAN = (allowOptionalFields) => allowOptionalFields ? schemaCAN$1() : strictSchemaCAN$1();
// Country-keyed mapping
const addressSchemaByCountry = {
    [CountryCode.USA]: addressSchemaUSA,
    [CountryCode.CAN]: addressSchemaCAN,
};

// Internal USA schemas
const schemaUSA = (role) => create$3({
    name: identityNameValidation.required(`Enter ${role} name`),
    title: identityTitleValidation.nullable(),
    email: emailValidation.nullable(),
    phone: phoneValidation.nullable(),
    dob_full: dobValidation(role).nullable(),
    ssn_last4: create$6().nullable(),
    identification_number: ssnValidation.nullable(),
    ownership_percentage: ownershipPercentageValidation.nullable(),
    address: addressSchemaUSA(true),
});
const strictSchemaUSA = (role) => create$3({
    name: identityNameValidation.required(`Enter ${role} name`),
    title: identityTitleValidation.required(`Enter ${role} title`),
    email: emailValidation.required(`Enter ${role} email`),
    phone: phoneValidation.required('Enter phone number'),
    dob_full: dobValidation(role).required('Enter date of birth'),
    ssn_last4: create$6().nullable(),
    // ssn required unless last4 provided (handled inside ssnValidation)
    identification_number: ssnValidation,
    ownership_percentage: role === 'owner'
        ? ownershipPercentageValidation.required('Enter ownership percentage')
        : ownershipPercentageValidation.nullable(),
    address: addressSchemaUSA(false),
});
// Internal CAN schemas
const schemaCAN = (role) => create$3({
    name: identityNameValidation.required(`Enter ${role} name`),
    title: identityTitleValidation.nullable(),
    email: emailValidation.nullable(),
    phone: phoneValidation.nullable(),
    dob_full: dobValidation(role).nullable(),
    ssn_last4: create$6().nullable(),
    identification_number: makeIdentityNumberValidation(CountryCode.CAN).nullable(),
    ownership_percentage: ownershipPercentageValidation.nullable(),
    address: addressSchemaCAN(true),
});
const strictSchemaCAN = (role) => create$3({
    name: identityNameValidation.required(`Enter ${role} name`),
    title: identityTitleValidation.required(`Enter ${role} title`),
    email: emailValidation.required(`Enter ${role} email`),
    phone: phoneValidation.required('Enter phone number'),
    dob_full: dobValidation(role).required('Enter date of birth'),
    ssn_last4: create$6().nullable(),
    identification_number: makeIdentityNumberValidation(CountryCode.CAN).nullable(),
    ownership_percentage: role === 'owner'
        ? ownershipPercentageValidation.required('Enter ownership percentage')
        : ownershipPercentageValidation.nullable(),
    address: addressSchemaCAN(false),
});
const identitySchemaUSA = (role, allowOptionalFields) => allowOptionalFields ? schemaUSA(role) : strictSchemaUSA(role);
const identitySchemaCAN = (role, allowOptionalFields) => allowOptionalFields ? schemaCAN(role) : strictSchemaCAN(role);
// Country-keyed mapping
const identitySchemaByCountry = {
    [CountryCode.USA]: identitySchemaUSA,
    [CountryCode.CAN]: identitySchemaCAN,
};

export { additionalQuestionsSchema as a, businessCoreInfoSchemaUSA as b, addressSchemaUSA as c, businessCoreInfoSchemaCAN as d, identitySchemaCAN as e, addressSchemaCAN as f, identitySchemaByCountry as g, addressSchemaByCountry as h, identitySchemaUSA as i };
