import { EInputComponentType, EInputType } from '@/UI-kit/types';
import { IDocsSchemaType } from '@/modules/form/types';
import { IPatentFieldsOptions } from '@/modules/documents/type';
import Date from '@/modules/documents/assets/images/documents/patent/date.svg';
import seriesBlank from '@/modules/documents/assets/images/documents/patent/series-blank.svg';
import SeriesDoc from '@/modules/documents/assets/images/documents/patent/series-doc.svg';
import { uiKitI18n } from '@/configs';
import { getPatentValidator } from '@/modules/documents/constants/validation/patent.validation';

export function usePatentFieldsScheme(options?: IPatentFieldsOptions): IDocsSchemaType[] {
    const { issueDate, payDate, blankNumber, documentNumber } = getPatentValidator();

    return [
        {
            name: 'document',
            label: uiKitI18n?.global.t('moduleDocuments.forms.patent.doc.label'),
            type: EInputType.text,
            placeholder: '__ ____________',
            validateOnChange: false,
            validator: documentNumber,
            mask: '## ###########',
            isShowClear: true,
            components: EInputComponentType.mask,
            helperImg: SeriesDoc,
        },
        {
            name: 'blank',
            label: uiKitI18n?.global.t('moduleDocuments.forms.patent.blank.label'),
            type: EInputType.text,
            placeholder: '__ ____________',
            validateOnChange: false,
            validator: blankNumber,
            mask: 'KK #######',
            isShowClear: true,
            components: EInputComponentType.mask,
            helperImg: seriesBlank,
        },
        {
            name: 'issue_date',
            label: uiKitI18n?.global.t('moduleDocuments.forms.patent.issue_date.label'),
            type: EInputType.text,
            placeholder: 'ДД.ММ.ГГГГ',
            validateOnChange: false,
            validator: issueDate,
            mask: '##.##.####',
            isDate: true,
            masked: true,
            isShowClear: true,
            components: EInputComponentType.mask,
            helperImg: Date,
        },
        {
            name: 'paid_until',
            label: uiKitI18n?.global.t('moduleDocuments.forms.patent.pay_date.label'),
            type: EInputType.text,
            placeholder: 'ДД.ММ.ГГГГ',
            validateOnChange: false,
            validator: payDate,
            mask: '##.##.####',
            isDate: true,
            masked: true,
            isShowClear: true,
            components: EInputComponentType.mask,
        },
    ];
}
