/*!
 * Built by ShiftSoftware
 * Copyright (c)
 */
import { c as create$3, a as create$5, b as create$6 } from './types-BDhR4pDq.js';
import { v as validateVin } from './validate-vin-CUREVASG.js';

const label = (name) => `${name}-label`;
const format = (name) => `${name}-format`;
const require = (name) => `${name}-require`;
const size = (name) => `${name}-size`;
const max = (name) => `${name}-max`;
const placeholder = (name) => `${name}-placeholder`;
const meta = (name) => ({ label: label(name), placeholder: placeholder(name) });
const condition = (name) => `$${name}Required`;
const y = { label, format, require, condition, placeholder, meta, size, max };
const getFormValidations = (extraFields = {}) => {
    return create$3(Object.assign({ name: create$6()
            .meta(meta('name'))
            .when(condition('name'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(require('name')).min(3, format('name')),
        }), lastName: create$6()
            .meta(meta('lastName'))
            .when(condition('lastName'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(require('lastName')).min(3, format('lastName')),
        }), message: create$6()
            .meta(meta('message'))
            .when(condition('message'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(require('message')).min(10, format('message')),
        }), email: create$6()
            .meta(meta('email'))
            .when(condition('email'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(require('email')),
        })
            .email(format('email')), vin: create$6()
            .meta(meta('vin'))
            .when(condition('vin'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(require('vin')).test(format('vin'), format('vin'), a => validateVin(a === null || a === void 0 ? void 0 : a.toUpperCase())),
        }), vehicle: create$6()
            .meta(meta('vehicle'))
            .when(y.condition('vehicle'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(y.require('vehicle')),
        }), vacancyId: create$6()
            .meta(meta('vacancyId'))
            .when(y.condition('vacancyId'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(y.require('vacancyId')),
        }), companyBranchId: create$6()
            .meta(meta('companyBranchId'))
            .when(y.condition('companyBranchId'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(y.require('companyBranchId')),
        }), cityId: create$6()
            .meta(meta('cityId'))
            .when(y.condition('cityId'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(y.require('cityId')),
        }), date: create$6()
            .meta(meta('date'))
            .when(condition('date'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(require('date')),
        }), year: create$6()
            .meta(meta('year'))
            .when(condition('year'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(require('year')),
        }), time: create$6()
            .meta(meta('time'))
            .when(condition('time'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(require('time')),
        }), currentVehicleBrand: create$6()
            .meta(meta('currentVehicleBrand'))
            .when('ownVehicle', {
            is: (val) => val === 'yes',
            then: schema => schema.required(require('currentVehicleBrand')),
            otherwise: schema => schema.optional(),
        }), currentVehicleModel: create$6()
            .meta(meta('currentVehicleModel'))
            .when(['ownVehicle', 'currentVehicleBrand'], {
            is: (ownVehicle, brand) => ownVehicle === 'yes' && brand !== 'Other',
            then: schema => schema.required(require('currentVehicleModel')),
            otherwise: schema => schema.optional(),
        }), ownVehicle: create$6()
            .meta(meta('ownVehicle'))
            .when(condition('ownVehicle'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(require('ownVehicle')),
        }), conditionalCurrentVehicleBrand: create$6()
            .meta(meta('currentVehicleBrand'))
            .when('ownVehicle', {
            is: (val) => val === 'yes',
            then: schema => schema.required(require('currentVehicleBrand')),
            otherwise: schema => schema.optional(),
        }), conditionalCurrentVehicleModel: create$6()
            .meta(meta('currentVehicleModel'))
            .when(['ownVehicle', 'conditionalCurrentVehicleBrand'], {
            is: (ownVehicle, brand) => ownVehicle === 'yes' && brand !== 'Other',
            then: schema => schema.required(require('currentVehicleModel')),
            otherwise: schema => schema.optional(),
        }), gender: create$5()
            .meta(meta('gender'))
            .when(condition('gender'), {
            is: true,
            otherwise: schema => schema.optional(),
            then: schema => schema.required(require('gender')),
        }) }, extraFields));
};

export { max as a, format as f, getFormValidations as g, meta as m, require as r, size as s, y };
