Skip to content

Commit

Permalink
Merge pull request #110 from nginformatica/feat/esocial-toxicological…
Browse files Browse the repository at this point in the history
…-event

Feat/esocial toxicological event
  • Loading branch information
juliakon authored Jul 17, 2024
2 parents 13935e6 + 219bd69 commit 8eaa6f5
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quirons-broker",
"version": "0.0.1-alpha.125",
"version": "0.0.1-alpha.126",
"description": "A small library to expose the broker types",
"main": "index.ts",
"typings": "index.d.ts",
Expand Down
3 changes: 3 additions & 0 deletions src/esocial/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as t from 'io-ts'

import { eSocial as evtCAT } from './schemas/evtCAT'
import { eSocial as evtMonit } from './schemas/evtMonit'
import { eSocial as evtToxic } from './schemas/evtMonit'
import { eSocial as evtExpRisco } from './schemas/evtExpRisco'
import { eSocial as evtExclusao } from './schemas/evtExclusao'
import { eSocial as evtInfoEmpregador } from './schemas/evtInfoEmpregador'
Expand All @@ -11,6 +12,7 @@ import { T_ideEmpregador } from './schemas/tipos'
export {
evtCAT,
evtMonit,
evtToxic,
evtExpRisco,
evtExclusao,
evtInfoEmpregador,
Expand All @@ -24,6 +26,7 @@ export type IdeEmpregador = t.TypeOf<typeof T_ideEmpregador>
export type eSocialObject =
| evtCAT
| evtMonit
| evtToxic
| evtExpRisco
| evtExclusao
| evtInfoEmpregador
Expand Down
2 changes: 2 additions & 0 deletions src/esocial/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as t from 'io-ts'

import { eSocial as evtCAT } from './schemas/evtCAT'
import { eSocial as evtMonit } from './schemas/evtMonit'
import { eSocial as evtToxic } from './schemas/evtToxic'
import { eSocial as evtExclusao } from './schemas/evtExclusao'
import { eSocial as evtExpRisco } from './schemas/evtExpRisco'
import { eSocial as evtInfoEmpregador } from './schemas/evtInfoEmpregador'
Expand Down Expand Up @@ -34,6 +35,7 @@ export const ESocialRequest = t.intersection([
message: t.union([
dataMessage('evtCAT', evtCAT),
dataMessage('evtMonit', evtMonit),
dataMessage('evtToxic', evtToxic),
dataMessage('evtExclusao', evtExclusao),
dataMessage('evtExpRisco', evtExpRisco),
dataMessage('evtInfoEmpregador', evtInfoEmpregador)
Expand Down
54 changes: 54 additions & 0 deletions src/esocial/schemas/evtToxic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import * as t from 'io-ts';
import * as tipos from './tipos'

/// S-2221 - Exame Toxicológico do Motorista Profissional Empregado
export const eSocial = t.type({
/// Evento Exame Toxicológico do Motorista Profissional Empregado
/// CHAVE_GRUPO: {Id}
/// REGRA:REGRA_ENVIO_PROC_FECHAMENTO
/// REGRA:REGRA_EVENTOS_EXTEMP
/// REGRA:REGRA_EVENTO_EXT_SEM_IMPACTO_FOPAG
/// REGRA:REGRA_EVENTO_POSTERIOR_CAT_OBITO
/// REGRA:REGRA_EXISTE_INFO_EMPREGADOR
/// REGRA:REGRA_EXISTE_VINCULO
/// REGRA:REGRA_EXTEMP_REINTEGRACAO
/// REGRA:REGRA_MESMO_PROCEMI
/// REGRA:REGRA_RETIFICA_MESMO_VINCULO
evtToxic: t.type({
$: t.type({
Id: tipos.TS_Id
}),
ideEvento: tipos.T_ideEvento_trab,
ideEmpregador: tipos.T_ideEmpregador,
ideVinculo: tipos.T_ideVinculo_sst,
/// Informações do exame toxicológico do motorista profissional.
/// CHAVE_GRUPO: {dtExame*}
toxicologico: t.intersection([
t.type({
/// Data da realização do exame toxicológico.
/// Validação: Deve ser uma data válida, igual ou anterior à data atual e igual ou posterior à data de início da obrigatoriedade deste evento para o empregador no eSocial.
dtExame: tipos.date,
/// CNPJ do laboratório responsável pela realização do exame.
/// Validação: Deve ser um CNPJ válido, com 14 (catorze) algarismos.
cnpjLab: tipos.TS_cnpj,
/// Código do exame toxicológico.
/// Validação: Deve possuir 11 (onze) caracteres, composto por duas letras (dois primeiros caracteres) e nove algarismos (últimos nove caracteres).
codSeqExame: t.string, // Use um tipo string para o código do exame, já que ele possui letras e números
/// Preencher com o nome do médico.
nmMed: tipos.TS_nome,
}),
t.partial({
/// Número de inscrição do médico no Conselho Regional de Medicina - CRM.
/// Validação: Preenchimento obrigatório, exceto se o endereço do trabalhador em S-2200 ou S-2205 vigente em {dtExame}(./dtExame) for no exterior.
nrCRM: tipos.TS_crm, // CRM pode ser nulo se o endereço for no exterior
/// Preencher com a sigla da Unidade da Federação - UF de expedição do CRM.
/// Validação: Preenchimento obrigatório, exceto se o endereço do trabalhador em S-2200 ou S-2205 vigente em {dtExame}(./dtExame) for no exterior.
ufCRM: tipos.TS_uf // UF do CRM pode ser nula se o endereço for no exterior
})
])

})
})

export type eSocial = t.TypeOf<typeof eSocial>

0 comments on commit 8eaa6f5

Please sign in to comment.