import { buildYupChain } from '@/UI-kit/utils';
import { string } from 'yup';
import { requiredValueValidator } from '@/modules/documents/constants/validation/common.validation';
import { uiKitI18n } from '@/configs';

export const driverLicenseValidation = () => ({
    name: 'vu',
    message: uiKitI18n?.global.t('helpers.validation.error'),
    test: (value?: string) => {
        console.log(value, 'value');
        if (!value) {
            return;
        }

        const valueWithoutSpaces = value.replaceAll(' ', '');
        return valueWithoutSpaces.length >= 10;
    },
});
export const geVUValidator = () =>
    buildYupChain(string(), [requiredValueValidator(), driverLicenseValidation()]);
