<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.esocial.gov.br/schema/evt/evtAfastTemp/v02_04_01" targetNamespace="http://www.esocial.gov.br/schema/evt/evtAfastTemp/v02_04_01" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>
  <xs:element name="eSocial">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="evtAfastTemp">
          <xs:annotation>
            <xs:documentation>Evento Afastamento Temporário</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ideEvento" type="TIdeEveTrab">
                <xs:annotation>
                  <xs:documentation>Informações de Identificação do Evento</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="ideEmpregador" type="TEmpregador">
                <xs:annotation>
                  <xs:documentation>Informações de identificação do empregador</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="ideVinculo">
                <xs:annotation>
                  <xs:documentation>Informações de Identificação do Trabalhador e do Vínculo.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="cpfTrab">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>CPF do trabalhador</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:length value="11"/>
                          <xs:pattern value="\d{11}"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="nisTrab" minOccurs="0">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>NIS</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="11"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="matricula" minOccurs="0">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Matricula</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:minLength value="1"/>
                          <xs:maxLength value="30"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="codCateg" minOccurs="0">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Código da Categoria</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:integer">
                          <xs:pattern value="\d{3}"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="infoAfastamento">
                <xs:annotation>
                  <xs:documentation>Informações do Evento</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="iniAfastamento" minOccurs="0">
                      <xs:annotation>
                        <xs:documentation>Informações do Afastamento Temporário - Início</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="dtIniAfast">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Data de início do afastamento</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:date">
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="codMotAfast">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Código do motivo de afastamento</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:string">
                                <xs:length value="2"/>
                                <xs:pattern value="\d{2}"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="infoMesmoMtv" minOccurs="0">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Informar se o afastamento decorre de mesmo acidente/doença anterior</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:string">
                                <xs:pattern value="[N|S]"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="tpAcidTransito" minOccurs="0">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Tipo de acidente de transito</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:byte">
                                <xs:pattern value="\d"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="observacao" minOccurs="0">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Observação</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:string">
                                <xs:whiteSpace value="preserve"/>
                                <xs:minLength value="3"/>
                                <xs:maxLength value="255"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="infoAtestado" minOccurs="0" maxOccurs="9">
                            <xs:annotation>
                              <xs:documentation>Informações complementares relativas ao atestado médico</xs:documentation>
                            </xs:annotation>
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="codCID" minOccurs="0">
                                  <xs:simpleType>
                                    <xs:annotation>
                                      <xs:documentation>Código CID</xs:documentation>
                                    </xs:annotation>
                                    <xs:restriction base="xs:string">
                                      <xs:pattern value="\w{3,4}"/>
                                    </xs:restriction>
                                  </xs:simpleType>
                                </xs:element>
                                <xs:element name="qtdDiasAfast">
                                  <xs:simpleType>
                                    <xs:annotation>
                                      <xs:documentation>Quantidade de dias de afastamento</xs:documentation>
                                    </xs:annotation>
                                    <xs:restriction base="xs:integer">
                                      <xs:pattern value="\d{1,3}"/>
                                    </xs:restriction>
                                  </xs:simpleType>
                                </xs:element>
                                <xs:element name="emitente">
                                  <xs:annotation>
                                    <xs:documentation>Médico/Dentista que emitiu o atestado</xs:documentation>
                                  </xs:annotation>
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="nmEmit">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Nome do médico/dentista</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:string">
                                            <xs:minLength value="2"/>
                                            <xs:maxLength value="70"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                      <xs:element name="ideOC">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Órgão de classe</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:byte">
                                            <xs:pattern value="\d"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                      <xs:element name="nrOc">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Inscr no órgão de classe</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:string">
                                            <xs:whiteSpace value="preserve"/>
                                            <xs:minLength value="3"/>
                                            <xs:maxLength value="14"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                      <xs:element name="ufOC" minOccurs="0">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Sigla da UF do órgão de classe</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:string">
                                            <xs:enumeration value="AC"/>
                                            <xs:enumeration value="AL"/>
                                            <xs:enumeration value="AP"/>
                                            <xs:enumeration value="AM"/>
                                            <xs:enumeration value="BA"/>
                                            <xs:enumeration value="CE"/>
                                            <xs:enumeration value="DF"/>
                                            <xs:enumeration value="ES"/>
                                            <xs:enumeration value="GO"/>
                                            <xs:enumeration value="MA"/>
                                            <xs:enumeration value="MT"/>
                                            <xs:enumeration value="MS"/>
                                            <xs:enumeration value="MG"/>
                                            <xs:enumeration value="PA"/>
                                            <xs:enumeration value="PB"/>
                                            <xs:enumeration value="PR"/>
                                            <xs:enumeration value="PE"/>
                                            <xs:enumeration value="PI"/>
                                            <xs:enumeration value="RJ"/>
                                            <xs:enumeration value="RN"/>
                                            <xs:enumeration value="RS"/>
                                            <xs:enumeration value="RO"/>
                                            <xs:enumeration value="RR"/>
                                            <xs:enumeration value="SC"/>
                                            <xs:enumeration value="SP"/>
                                            <xs:enumeration value="SE"/>
                                            <xs:enumeration value="TO"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="infoCessao" minOccurs="0">
                            <xs:annotation>
                              <xs:documentation>Registro preenchido nos casos de afastamento por cessão ou requisição do trabalhador.</xs:documentation>
                            </xs:annotation>
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="cnpjCess">
                                  <xs:simpleType>
                                    <xs:annotation>
                                      <xs:documentation>CNPJ do Cessionário</xs:documentation>
                                    </xs:annotation>
                                    <xs:restriction base="xs:string">
                                      <xs:length value="14"/>
                                      <xs:pattern value="\d{8,14}"/>
                                    </xs:restriction>
                                  </xs:simpleType>
                                </xs:element>
                                <xs:element name="infOnus">
                                  <xs:simpleType>
                                    <xs:annotation>
                                      <xs:documentation>Ônus da Cessão</xs:documentation>
                                    </xs:annotation>
                                    <xs:restriction base="xs:byte">
                                      <xs:pattern value="\d"/>
                                    </xs:restriction>
                                  </xs:simpleType>
                                </xs:element>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="infoMandSind" minOccurs="0">
                            <xs:annotation>
                              <xs:documentation>Informações Complementares - afastamento para exercício de mandato sindical</xs:documentation>
                            </xs:annotation>
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="cnpjSind">
                                  <xs:simpleType>
                                    <xs:annotation>
                                      <xs:documentation>CNPJ do Sindicato</xs:documentation>
                                    </xs:annotation>
                                    <xs:restriction base="xs:string">
                                      <xs:length value="14"/>
                                      <xs:pattern value="\d{8,14}"/>
                                    </xs:restriction>
                                  </xs:simpleType>
                                </xs:element>
                                <xs:element name="infOnusRemun">
                                  <xs:simpleType>
                                    <xs:annotation>
                                      <xs:documentation>Ônus da Remuneração</xs:documentation>
                                    </xs:annotation>
                                    <xs:restriction base="xs:byte">
                                      <xs:pattern value="\d"/>
                                    </xs:restriction>
                                  </xs:simpleType>
                                </xs:element>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="infoRetif" minOccurs="0">
                      <xs:annotation>
                        <xs:documentation>Informações de retificação do Afastamento Temporário. Preenchimento obrigatório caso {codMotAfast} seja retificado de [01] para [03] ou de [03] para [01].</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="origRetif">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Origem da retificação</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:byte">
                                <xs:pattern value="\d"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="tpProc" minOccurs="0">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Tipo de Processo</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:byte">
                                <xs:pattern value="\d"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="nrProc" minOccurs="0">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Número do Processo</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:string">
                                <xs:maxLength value="20"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="fimAfastamento" minOccurs="0">
                      <xs:annotation>
                        <xs:documentation>Informações do Término do Afastamento</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="dtTermAfast">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Preencher com a data do término do afastamento do trabalhador.</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:date">
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="Id" type="xs:ID" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element ref="ds:Signature"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="TIdeEveTrab">
    <xs:annotation>
      <xs:documentation>Identificação do evento</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="indRetif">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Indicativo de Retificação</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:byte">
            <xs:pattern value="\d"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="nrRecibo" minOccurs="0">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Recibo arquivo a ser retificado</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
            <xs:maxLength value="40"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="tpAmb">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Tipo de ambiente</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:byte">
            <xs:pattern value="\d"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="procEmi">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Processo de emissão do evento</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:byte">
            <xs:pattern value="\d"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="verProc">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Versão do processo de emissão do evento. </xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
            <xs:maxLength value="20"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TEmpregador">
    <xs:sequence>
      <xs:element name="tpInsc">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Tipo de Inscrição, conforme tabela 5.</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:byte">
            <xs:pattern value="\d"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="nrInsc">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Número de Inscrição</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:string">
            <xs:pattern value="\d{8,15}"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>
