<?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/evtBenPrRP/v02_04_01" targetNamespace="http://www.esocial.gov.br/schema/evt/evtBenPrRP/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="evtBenPrRP">
          <xs:annotation>
            <xs:documentation>Evento remuneração de trabalhadores vinculados a Regime Próprio de Previdência Social</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ideEvento" type="TIdeEveFopag">
                <xs:annotation>
                  <xs:documentation>Informações de identificação do evento</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="ideEmpregador" type="TEmprPJ">
                <xs:annotation>
                  <xs:documentation>Informações de identificação do empregador</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="ideBenef">
                <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="cpfBenef">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>CPF do beneficiário</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:pattern value="\d{11}"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="dmDev" maxOccurs="99">
                <xs:annotation>
                  <xs:documentation>Identificação de cada um dos demonstrativos de valores devidos ao beneficiário antes das retenções de pensão alimentícia e IRRF. (As retenções de pensão alimentícia e IRRF devem ser realizadas no ato do pagamento e, portanto, são informadas no evento S-1210).
O somatório de cada uma das rubricas cujo {codIncCP} = [31, 32, 34, 35] não pode ser negativo.
O somatório dos Vencimentos deve ser maior ou igual ao somatório dos Descontos.</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="tpBenef">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Tipo de benefício previdenciário, conforme tabela 25</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:byte">
                          <xs:pattern value="\d{1,2}"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="nrBenefic">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Número do benefício</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:minLength value="3"/>
                          <xs:maxLength value="20"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="ideDmDev">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Identificador do demonstrativo de pagamento</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="itens" maxOccurs="99">
                      <xs:annotation>
                        <xs:documentation>Detalhamento dos valores devidos ao beneficiário</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <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="vrRubr">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Valor total da rubrica</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: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="TIdeEveFopag">
    <xs:annotation>
      <xs:documentation>Identificação do evento periódico</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="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:complexType name="TEmprPJ">
    <xs:annotation>
      <xs:documentation>Informações do Empregador PJ</xs:documentation>
    </xs:annotation>
    <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>
