{"size": 2923, "ext": "js", "max_stars_repo_path": "frontend/src/utils/registerMap.js", "max_stars_repo_name": "Dev-Nine/Hack-COVID-19", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "frontend/src/utils/registerMap.js", "max_issues_repo_name": "Dev-Nine/Hack-COVID-19", "max_issues_repo_issues_event_min_datetime": "2022-02-13T17:18:11.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-13T17:18:11.000Z", "max_forks_repo_path": "frontend/src/utils/registerMap.js", "max_forks_repo_name": "Dev-Nine/Hack-COVID-19", "max_forks_repo_forks_event_min_datetime": "2021-04-12T03:56:56.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-12T03:56:56.000Z"}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 21.6518518519, "max_line_length": 77, "alphanum_fraction": 0.5473828259}
import * as Yup from 'yup';
import { cpf } from 'cpf-cnpj-validator';

const registerMap = new Map();

registerMap.set('default', {
    name: 'Selecione o tipo de registro...',
    register: '',
    state: false,
    mask: '',
    test: null,
});

registerMap.set('crp', {
    name: 'Psicólogo',
    register: 'CRP',
    state: true,
    mask: '99/999999',
    test: Yup.string().matches(
        /^[1-9]{2}[/]{1}[1-9]{6}$/,
        'Um CRP deve possuir 8 digitos numéricos',
    ),
});

registerMap.set('crf', {
    name: 'Farmacêutico / Bioquímico',
    register: 'CRF',
    state: true,
    mask: '99999',
    test: Yup.string().matches(
        /^[1-9]{5}$/,
        'Um CRF deve possuir 5 digitos numéricos',
    ),
});

registerMap.set('crfa', {
    name: 'Fonoaudióloga',
    register: 'CRFa',
    state: true,
    mask: '99.999',
    test: Yup.string().matches(
        /^[1-9]{2}[.]{1}[1-9]{3}$/,
        'Um CRFa deve possuir 5 digitos numéricos',
    ),
});

registerMap.set('cro', {
    name: 'Dentista',
    register: 'CRO',
    state: true,
    mask: '99999',
    test: Yup.string().matches(
        /^[1-9]{5}$/,
        'Um CRO deve possuir 5 digitos numéricos',
    ),
});

registerMap.set('coren', {
    name: 'Enfermeiro',
    register: 'Coren',
    state: true,
    mask: '999999',
    test: Yup.string().matches(
        /^[1-9]{6}$/,
        'Um Coren deve possuir 6 digitos numéricos',
    ),
});

registerMap.set('crm', {
    name: 'Médico',
    register: 'CRM',
    state: true,
    mask: '999999',
    test: Yup.string().matches(
        /^[1-9]{6}$/,
        'Um CRM deve possuir 6 digitos numéricos',
    ),
});

registerMap.set('crn', {
    name: 'Nutricionista',
    register: 'CRN',
    state: true,
    mask: '99999',
    test: Yup.string().matches(
        /^[1-9]{5}$/,
        'O CRN deve possuir 5 digitos numéricos',
    ),
});

registerMap.set('crefito', {
    name: 'Fisioterapeuta',
    register: 'CREFITO',
    state: true,
    mask: '999999',
    test: Yup.string().matches(
        /^[1-9]{5}$/,
        'O CREFITO deve possuir 6 digitos numéricos',
    ),
});

registerMap.set('acm', {
    name: 'Agente Comunitário de Endemia',
    register: 'Número de matrícula (ACM)',
    state: false,
    mask: '999999',
    test: Yup.string().matches(
        /^[1-9]{6}$/,
        'O número da matrícula deve possuir 6 digitos numéricos',
    ),
});

registerMap.set('ace', {
    name: 'Agente de Combate à Endemia',
    register: 'Número de matrícula (ACE)',
    state: false,
    mask: '999999',
    test: Yup.string().matches(
        /^[1-9]{6}$/,
        'O número da matrícula deve possuir 6 digitos numéricos',
    ),
});

registerMap.set('cpf', {
    name: 'Outros',
    register: 'CPF',
    state: false,
    mask: '999.999.999-99',
    test: Yup.string().test('CPF válido', 'Informe um CPF válido', (value) =>
        cpf.isValid(value),
    ),
});

export default registerMap;
