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

export const medicalBookValidator = () => ({
    name: 'medical-book-length',
    message: uiKitI18n?.global.t('helpers.validation.error'),
    test: (value?: string) => !value || value.length > 1,
});

export const getMedicalBookValidator = () =>
    buildYupChain(string(), [requiredValueValidator(), medicalBookValidator()]);
