import { c as create$3, a as create$6 } from './form.js';
import { a as addressSchemaCAN, b as addressSchemaUSA } from './business-address-schema.js';
import { u as ownershipPercentageValidation, v as makeIdentityNumberValidation, x as dobValidation, j as phoneValidation, k as emailValidation, y as identityTitleValidation, i as identityNameValidation, z as ssnValidation } from './schema-validations.js';
import { a as CountryCode } from './Business.js';

// 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 { identitySchemaUSA as a, identitySchemaCAN as b, identitySchemaByCountry as i };
