import { c as create$3, a as create$6 } from './form.js';
import { m as makeTaxIdValidation, e as dateOfIncorporationValidation, f as industryValidation, g as businessClassificationValidation, h as doingBusinessAsValidation, j as phoneValidation, k as emailValidation, n as websiteUrlValidation, q as businessNameValidation, t as taxIdValidation } from './schema-validations.js';
import { a as CountryCode } from './Business.js';
import { c as countryLabels } from './country-config.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(),
    }),
}));

export { businessCoreInfoSchemaUSA as a, businessCoreInfoSchemaCAN as b };
