<?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/evtTabRubrica/v02_04_02" targetNamespace="http://www.esocial.gov.br/schema/evt/evtTabRubrica/v02_04_02" 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="evtTabRubrica">
          <xs:annotation>
            <xs:documentation>Evento destinado a incluir, alterar ou excluir informações da tabela de rubricas</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ideEvento" type="TIdeCadastro">
              </xs:element>
              <xs:element name="ideEmpregador" type="TEmpregador">
              </xs:element>
              <xs:element name="infoRubrica">
                <xs:annotation>
                  <xs:documentation>Identificação da operação (inclusão, alteração ou exclusão) e das informações da rubrica.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:choice>
                      <xs:element name="inclusao">
                        <xs:annotation>
                          <xs:documentation>Inclusão de novas informações</xs:documentation>
                        </xs:annotation>
                        <xs:complexType>
                          <xs:sequence>
                            <xs:element name="ideRubrica" type="TIdeRubrica">
                              <xs:annotation>
                                <xs:documentation>Informações de identificação da rubrica e validade das informações que estão sendo incluídas</xs:documentation>
                              </xs:annotation>
                            </xs:element>
                            <xs:element name="dadosRubrica" type="TDadosRubrica">
                              <xs:annotation>
                                <xs:documentation>Detalhamento das informações da rubrica que está sendo incluída</xs:documentation>
                              </xs:annotation>
                            </xs:element>
                          </xs:sequence>
                        </xs:complexType>
                      </xs:element>
                      <xs:element name="alteracao">
                        <xs:annotation>
                          <xs:documentation>Alteração de informações já existentes</xs:documentation>
                        </xs:annotation>
                        <xs:complexType>
                          <xs:sequence>
                            <xs:element name="ideRubrica" type="TIdeRubrica">
                              <xs:annotation>
                                <xs:documentation>Grupo de informações de identificação da rubrica, apresentando código e período de validade da rubrica cujas informações serão alteradas pelos dados constantes neste evento.</xs:documentation>
                              </xs:annotation>
                            </xs:element>
                            <xs:element name="dadosRubrica" type="TDadosRubrica">
                              <xs:annotation>
                                <xs:documentation>Informações da rubrica</xs:documentation>
                              </xs:annotation>
                            </xs:element>
                            <xs:element name="novaValidade" type="TPeriodoValidade" minOccurs="0">
                              <xs:annotation>
                                <xs:documentation>Informação preenchida exclusivamente em caso de alteração do período de validade das informações da rubrica identificada em {ideRubrica}, apresentando o novo período de validade.</xs:documentation>
                              </xs:annotation>
                            </xs:element>
                          </xs:sequence>
                        </xs:complexType>
                      </xs:element>
                      <xs:element name="exclusao">
                        <xs:annotation>
                          <xs:documentation>Exclusão de informações</xs:documentation>
                        </xs:annotation>
                        <xs:complexType>
                          <xs:sequence>
                            <xs:element name="ideRubrica" type="TIdeRubrica">
                              <xs:annotation>
                                <xs:documentation>Grupo de informações que identifica a rubrica que será excluída.</xs:documentation>
                              </xs:annotation>
                            </xs:element>
                          </xs:sequence>
                        </xs:complexType>
                      </xs:element>
                    </xs:choice>
                  </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="TIdeCadastro">
    <xs:annotation>
      <xs:documentation>Identificação de evento de cadastro/tabelas</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <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:complexType name="TIdeRubrica">
    <xs:annotation>
      <xs:documentation>Informações de identificação da rubrica (código) e período de validade</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="codRubr">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Código da Rubrica</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="ideTabRubr">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Identificador da tabela de rubricas</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
            <xs:maxLength value="8"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="iniValid">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Início da validade (AAAA-MM)</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:string">
            <xs:pattern value="[2]{1}\d{3}-(1[0-2]|0[1-9])"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="fimValid" minOccurs="0">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Período final da validade, no formato (AAAA-MM)</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:string">
            <xs:pattern value="[2]{1}\d{3}-(1[0-2]|0[1-9])"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TDadosRubrica">
    <xs:annotation>
      <xs:documentation>Detalhamento da rubrica</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="dscRubr">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Descrição da rubrica no sistema de folha</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
            <xs:maxLength value="100"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="natRubr">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Código de Classificação da Rubrica</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:integer">
            <xs:pattern value="\d{4}"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="tpRubr">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Tipo de rubrica</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:byte">
            <xs:pattern value="\d"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="codIncCP">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Incidência para a Previdência Social</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="codIncIRRF">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Incidência para o IRRF</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="codIncFGTS">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Incidência para o FGTS</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="codIncSIND">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Incidência para a Contribuição Sindical</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="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="ideProcessoCP" minOccurs="0" maxOccurs="99">
        <xs:annotation>
          <xs:documentation>Caso a empresa possua processo administrativo ou judicial com decisão/sentença favorável, determinando a não incidência de contribuição previdenciária relativa a rubrica identificada no evento, as informações deverão ser incluídas neste registro, e o detalhamento do processo deverá ser efetuado através de evento específico na tabela de processos.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="tpProc">
              <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">
              <xs:simpleType>
                <xs:annotation>
                  <xs:documentation>Número do Processo</xs:documentation>
                </xs:annotation>
                <xs:restriction base="xs:string">
                  <xs:minLength value="3"/>
                  <xs:maxLength value="21"/>
                </xs:restriction>
              </xs:simpleType>
            </xs:element>
            <xs:element name="extDecisao">
              <xs:simpleType>
                <xs:annotation>
                  <xs:documentation>Extensão da Decisão/Sentença</xs:documentation>
                </xs:annotation>
                <xs:restriction base="xs:byte">
                  <xs:pattern value="\d"/>
                </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:element name="ideProcessoIRRF" minOccurs="0" maxOccurs="99">
        <xs:annotation>
          <xs:documentation>Caso a empresa possua processo judicial com decisão/sentença favorável, determinando a não incidência de imposto de renda relativo a rubrica identificada no evento, as informações deverão ser incluídas neste registro, e o detalhamento do processo deverá ser efetuado através de evento específico na tabela de processos.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="nrProc">
              <xs:simpleType>
                <xs:annotation>
                  <xs:documentation>Número do Processo</xs:documentation>
                </xs:annotation>
                <xs:restriction base="xs:string">
                  <xs:minLength value="3"/>
                  <xs:maxLength value="21"/>
                </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:element name="ideProcessoFGTS" minOccurs="0" maxOccurs="99">
        <xs:annotation>
          <xs:documentation>Caso a empresa possua processo judicial com decisão/sentença favorável, determinando a não incidência de FGTS relativo a rubrica identificada no evento, as informações deverão ser incluídas neste registro, e o detalhamento do processo deverá ser efetuado através de evento específico na tabela de processos.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="nrProc">
              <xs:simpleType>
                <xs:annotation>
                  <xs:documentation>Número do Processo</xs:documentation>
                </xs:annotation>
                <xs:restriction base="xs:string">
                  <xs:minLength value="3"/>
                  <xs:maxLength value="21"/>
                </xs:restriction>
              </xs:simpleType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="ideProcessoSIND" minOccurs="0" maxOccurs="99">
        <xs:annotation>
          <xs:documentation>Caso a empresa possua processo judicial com decisão/sentença favorável, determinando a não incidência de contribuição sindical relativa a rubrica identificada no evento, as informações deverão ser incluídas neste registro, e o detalhamento do processo deverá ser efetuado através de evento específico na tabela de processos.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:sequence>
            <xs:element name="nrProc">
              <xs:simpleType>
                <xs:annotation>
                  <xs:documentation>Número do Processo</xs:documentation>
                </xs:annotation>
                <xs:restriction base="xs:string">
                  <xs:minLength value="3"/>
                  <xs:maxLength value="21"/>
                </xs:restriction>
              </xs:simpleType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TPeriodoValidade">
    <xs:sequence>
      <xs:element name="iniValid">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Início da validade (AAAA-MM)</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:string">
            <xs:pattern value="[2]{1}\d{3}-(1[0-2]|0[1-9])"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="fimValid" minOccurs="0">
        <xs:simpleType>
          <xs:annotation>
            <xs:documentation>Período final da validade, no formato (AAAA-MM)</xs:documentation>
          </xs:annotation>
          <xs:restriction base="xs:string">
            <xs:pattern value="[2]{1}\d{3}-(1[0-2]|0[1-9])"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>
