/*!
 * Built by ShiftSoftware
 * Copyright (c)
 */
'use strict';

var types = require('./types-DV_cOCRi.js');
var validateVin = require('./validate-vin-CJDIXpJO.js');

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

exports.format = format;
exports.getFormValidations = getFormValidations;
exports.max = max;
exports.meta = meta;
exports.require = require$1;
exports.size = size;
exports.y = y;
