<?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/evtBasesTrab/v02_04_01" targetNamespace="http://www.esocial.gov.br/schema/evt/evtBasesTrab/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="evtBasesTrab">
          <xs:annotation>
            <xs:documentation>Evento Bases por Trabalhador</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ideEvento">
                <xs:annotation>
                  <xs:documentation>Identificação do evento de retorno</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="nrRecArqBase" minOccurs="0">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Recibo do arquivo de origem</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="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: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="ideTrabalhador">
                <xs:annotation>
                  <xs:documentation>Registro que apresenta a identificação básica do trabalhador ao qual se refere o evento de remuneração.</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="procJudTrab" minOccurs="0" maxOccurs="99">
                      <xs:annotation>
                        <xs:documentation>Informações sobre processos judiciais do trabalhador com decisão favorável quanto à não incidência ou alterações na incidência de contribuição previdenciária.</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="nrProcJud">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Nr Processo Judicial</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:string">
                                <xs:minLength value="1"/>
                                <xs:maxLength value="20"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="codSusp">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Código do Indicativo da Suspensão</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:integer">
                                <xs:pattern value="\d{1,14}"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="infoCpCalc" minOccurs="0" maxOccurs="9">
                <xs:annotation>
                  <xs:documentation>Cálculo da contribuição previdenciária do segurado, incidente sobre a Remuneração do Período de Apuração e de Períodos Anteriores informada nos eventos S-1200, S-2299 e S-2399.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="tpCR">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Código de Receita - CR.</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:integer">
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="vrCpSeg">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Valor da contribuição do segurado calculada segundo as regras da legislação em vigor, por CR.</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:decimal">
                          <xs:totalDigits value="14"/>
                          <xs:fractionDigits value="2"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="vrDescSeg">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Valor efetivamente descontado do segurado.</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:decimal">
                          <xs:totalDigits value="14"/>
                          <xs:fractionDigits value="2"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="infoCp">
                <xs:annotation>
                  <xs:documentation>Informações sobre bases de cálculo, descontos e deduções de contribuições sociais devidas à Previdência Social e a Outras Entidades e Fundos, referentes à Remuneração do Período de Apuração e de Períodos Anteriores informados nos eventos S-1200, S-2299 e S-2399.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="ideEstabLot" maxOccurs="99">
                      <xs:annotation>
                        <xs:documentation>Identificação do estabelecimento ou obra de construção civil e da lotação tributária.
As informações desse grupo foram prestadas pelo contribuinte nos eventos S-1200, S-2299 e S-2399.</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <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:element name="codLotacao">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Código da Lotação</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="infoCategIncid" maxOccurs="10">
                            <xs:annotation>
                              <xs:documentation>Informações relativas à matrícula e categoria do trabalhador e tipos de incidências.</xs:documentation>
                            </xs:annotation>
                            <xs:complexType>
                              <xs:sequence>
                                <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">
                                  <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:element name="indSimples" minOccurs="0">
                                  <xs:simpleType>
                                    <xs:annotation>
                                      <xs:documentation>Indicador de Contribuição Substituída</xs:documentation>
                                    </xs:annotation>
                                    <xs:restriction base="xs:byte">
                                      <xs:pattern value="\d"/>
                                    </xs:restriction>
                                  </xs:simpleType>
                                </xs:element>
                                <xs:element name="infoBaseCS" minOccurs="0" maxOccurs="99">
                                  <xs:annotation>
                                    <xs:documentation>Informações sobre bases de cálculo, descontos e deduções de contribuições sociais devidas à Previdência Social e a Outras Entidades e Fundos.
Evento de origem (S-1200, S-2299 e S-2399).</xs:documentation>
                                  </xs:annotation>
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="ind13">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Indicativo 13°</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:byte">
                                            <xs:pattern value="\d"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                      <xs:element name="tpValor">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Tipo de valor</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:byte">
                                            <xs:pattern value="\d{1,2}"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                      <xs:element name="valor">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Valor</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:decimal">
                                            <xs:totalDigits value="14"/>
                                            <xs:fractionDigits value="2"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="calcTerc" minOccurs="0" maxOccurs="2">
                                  <xs:annotation>
                                    <xs:documentation>Cálculo das contribuições sociais devidas a Outras Entidades e Fundos.</xs:documentation>
                                  </xs:annotation>
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="tpCR">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Código de Receita - CR.</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:integer">
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                      <xs:element name="vrCsSegTerc">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Valor da contribuição social devida a Outras Entidades ou Fundos.</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:decimal">
                                            <xs:totalDigits value="14"/>
                                            <xs:fractionDigits value="2"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                      <xs:element name="vrDescTerc">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Valor efetivamente descontado</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:decimal">
                                            <xs:totalDigits value="14"/>
                                            <xs:fractionDigits value="2"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                              </xs:sequence>
                            </xs:complexType>
                          </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="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>
