<?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/evtFechaEvPer/v02_04_01" targetNamespace="http://www.esocial.gov.br/schema/evt/evtFechaEvPer/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="evtFechaEvPer">
          <xs:annotation>
            <xs:documentation>Evento de Fechamento</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ideEvento">
                <xs:annotation>
                  <xs:documentation>Informações de identificação do evento</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="indApuracao">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Indicativo de período de apuração:
                          1 - Mensal;
                          2 - Anual (13° salário).</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:byte">
                          <xs:pattern value="\d"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="perApur">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Período ao qual se referem as informações.</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:minLength value="4"/>
                          <xs:maxLength value="7"/>
                        </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: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="ideRespInf" minOccurs="0">
                <xs:annotation>
                  <xs:documentation>Responsável pelas informações</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="nmResp">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Responsável pelas informações</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="cpfResp">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Número de Inscrição no CPF</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="telefone">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Número do telefone com DDD</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:minLength value="8"/>
                          <xs:maxLength value="13"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="email" minOccurs="0">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Endereço eletrônico</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:minLength value="6"/>
                          <xs:maxLength value="60"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="infoFech">
                <xs:annotation>
                  <xs:documentation>Informações do Fechamento</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="evtRemun">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Remuneração de trabalhadores no período de apuração</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:length value="1"/>
                          <xs:pattern value="[N|S]"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="evtPgtos">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Informações de pagamentos</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:pattern value="[N|S]"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="evtAqProd">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Informações sobre aquisição de produção</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:length value="1"/>
                          <xs:pattern value="[N|S]"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="evtComProd">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Informações de comercialização</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:length value="1"/>
                          <xs:pattern value="[N|S]"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="evtContratAvNP">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Contratatação de avulsos não portuários</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:length value="1"/>
                          <xs:pattern value="[N|S]"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="evtInfoComplPer">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Informações complementares aos periódicos</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:pattern value="[N|S]"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="compSemMovto" minOccurs="0">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Competência sem movimento</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:length value="7"/>
                          <xs:pattern value="[2]{1}\d{3}-(1[0-2]|0[1-9])"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </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="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>
