<?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.reinf.esocial.gov.br/schemas/evtInfoProdRural/v1_04_00" targetNamespace="http://www.reinf.esocial.gov.br/schemas/evtInfoProdRural/v1_04_00" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="./xmldsig-core-schema.xsd"/>
  <xs:element name="Reinf">
    <xs:annotation>
      <xs:documentation>EFD-Reinf</xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="evtComProd" minOccurs="1" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>Evento Comercialização da Produção</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ideEvento" minOccurs="1" maxOccurs="1">
                <xs:annotation>
                  <xs:documentation>Informações de identificação do evento</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="indRetif" minOccurs="1" maxOccurs="1">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Informe [1] para arquivo original ou [2] para arquivo de retificação.</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:unsignedByte">
                          <xs:pattern value="[1|2]"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="nrRecibo" minOccurs="0" maxOccurs="1">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Preencher com o número do recibo do arquivo a ser retificado.</xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:string">
                          <xs:minLength value="16"/>
                          <xs:maxLength value="52"/>
                          <xs:pattern value="[0-9]{1,18}[-][0-9]{2}[-][0-9]{4}[-][0-9]{4}[-][0-9]{1,18}"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="perApur" minOccurs="1" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>Informar o ano/mês (formato AAAA-MM) de referência das informações</xs:documentation>
                      </xs:annotation>
                      <xs:simpleType>
                        <xs:restriction base="xs:gYearMonth">
                          <xs:pattern value="20([0-9][0-9])-(0[1-9]|1[0-2])"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="tpAmb" minOccurs="1" maxOccurs="1">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>
                            Identificação do ambiente:
                            1 - Produção;
                            2 - Produção restrita;
                          </xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:unsignedInt">
                          <xs:pattern value="[1|2]"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="procEmi" minOccurs="1" maxOccurs="1">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>
                            Processo de emissão do evento:
                            1 - Aplicativo do contribuinte;
                            2 - Aplicativo governamental
                          </xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:unsignedByte">
                          <xs:pattern value="[1|2]"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="verProc" minOccurs="1" maxOccurs="1">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>Versão do processo de emissão do evento. Informar a versão do aplicativo emissor 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="ideContri" minOccurs="1" maxOccurs="1">
                <xs:annotation>
                  <xs:documentation>Informações de identificação do contribuinte</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="tpInsc" minOccurs="1" maxOccurs="1">
                      <xs:simpleType>
                        <xs:annotation>
                          <xs:documentation>
                            Preencher com o código correspondente ao tipo de inscrição do contribuinte
                            Deve ser igual a [1] (CNPJ).
                          </xs:documentation>
                        </xs:annotation>
                        <xs:restriction base="xs:unsignedByte">
                          <xs:pattern value="1"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="nrInsc" minOccurs="1" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>
                          Informar o CNPJ apenas com a Raiz/Base de oito posições, exceto se natureza jurídica do declarante for de
                          administração pública direta federal ([101-5], [104-0], [107-4] e [116-3]), situação em que o campo deve
                          ser preenchido com o CNPJ completo com 14 posições.
                        </xs:documentation>
                      </xs:annotation>
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:pattern value="[0-9]{8}|[0-9]{14}"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="infoComProd" minOccurs="1" maxOccurs="1">
                <xs:annotation>
                  <xs:documentation>Informação da Comercialização de Produção</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="ideEstab" minOccurs="1" maxOccurs="1">
                      <xs:annotation>
                        <xs:documentation>Registro que identifica o estabelecimento que comercializou a produção</xs:documentation>
                      </xs:annotation>
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="tpInscEstab" minOccurs="1" maxOccurs="1">
                            <xs:annotation>
                              <xs:documentation>Preencher com o código correspondente ao tipo de inscrição</xs:documentation>
                            </xs:annotation>
                            <xs:simpleType>
                              <xs:restriction base="xs:unsignedByte">
                                <xs:pattern value="1"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="nrInscEstab" minOccurs="1" maxOccurs="1">
                            <xs:annotation>
                              <xs:documentation>
                                Informar o número de inscrição do estabelecimento do contribuinte declarante, de acordo com
                                o tipo de inscrição indicado no campo {tpInscEstab}.
                              </xs:documentation>
                            </xs:annotation>
                            <xs:simpleType>
                              <xs:restriction base="xs:string">
                                <xs:pattern value="[0-9]{14}"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="vlrRecBrutaTotal" minOccurs="1" maxOccurs="1">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Valor da Receita Bruta Total do Estabelecimento no Período.</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:string">
                                <xs:minLength value="4"/>
                                <xs:maxLength value="17" />
                                <xs:pattern value="[0-9]{1,14}[,][0-9]{2}"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="vlrCPApur" minOccurs="1" maxOccurs="1">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>
                                  Valor da Contribuição Previdenciária
                                  Pode ser igual a zero.
                                </xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:string">
                                <xs:minLength value="4"/>
                                <xs:maxLength value="17" />
                                <xs:pattern value="[0-9]{1,14}[,][0-9]{2}"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="vlrRatApur" minOccurs="1" maxOccurs="1">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>
                                  Valor da Contribuição Previdenciária GILRAT
                                  Pode ser igual a zero.
                                </xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:string">
                                <xs:minLength value="4"/>
                                <xs:maxLength value="17" />
                                <xs:pattern value="[0-9]{1,14}[,][0-9]{2}"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="vlrSenarApur" minOccurs="1" maxOccurs="1">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>
                                  Valor da Contribuição para o SENAR
                                </xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:string">
                                <xs:minLength value="4"/>
                                <xs:maxLength value="17" />
                                <xs:pattern value="[0-9]{1,14}[,][0-9]{2}"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="vlrCPSuspTotal" minOccurs="0" maxOccurs="1">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Valor da Contribuição Previdenciária com exigibilidade suspensa</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:string">
                                <xs:minLength value="4"/>
                                <xs:maxLength value="17" />
                                <xs:pattern value="[0-9]{1,14}[,][0-9]{2}"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="vlrRatSuspTotal" minOccurs="0" maxOccurs="1">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Valor da contribuição Gilrat com exigibilidade suspensa</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:string">
                                <xs:minLength value="4"/>
                                <xs:maxLength value="17" />
                                <xs:pattern value="[0-9]{1,14}[,][0-9]{2}"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="vlrSenarSuspTotal" minOccurs="0" maxOccurs="1">
                            <xs:simpleType>
                              <xs:annotation>
                                <xs:documentation>Valor da contribuição para o Senar com exigibilidade suspensa</xs:documentation>
                              </xs:annotation>
                              <xs:restriction base="xs:string">
                                <xs:minLength value="4"/>
                                <xs:maxLength value="17" />
                                <xs:pattern value="[0-9]{1,14}[,][0-9]{2}"/>
                              </xs:restriction>
                            </xs:simpleType>
                          </xs:element>
                          <xs:element name="tipoCom" minOccurs="1" maxOccurs="4">
                            <xs:annotation>
                              <xs:documentation>Registro que apresenta o valor total da Receita Bruta por "tipo" de comercialização.</xs:documentation>
                            </xs:annotation>
                            <xs:complexType>
                              <xs:sequence>
                                <xs:element name="indCom" minOccurs="1" maxOccurs="1">
                                  <xs:simpleType>
                                    <xs:annotation>
                                      <xs:documentation>
                                        Indicativo de Comercialização:
                                        1 - Comercialização da Produção por Prod. Rural PJ/Agroindústria, exceto para entidades executoras do PAA;
                                        7 - Comercialização da Produção com Isenção de Contribuição Previdenciária, de acordo com a Lei n° 13.606/2018;
                                        8 - Comercialização da Produção para Entidade do Programa de Aquisição de Alimentos - PAA
                                        9 - Comercialização direta da Produção no Mercado Externo
                                      </xs:documentation>
                                    </xs:annotation>
                                    <xs:restriction base="xs:unsignedByte">
                                      <xs:pattern value="[1|7|8|9]"/>
                                    </xs:restriction>
                                  </xs:simpleType>
                                </xs:element>
                                <xs:element name="vlrRecBruta" minOccurs="1" maxOccurs="1">
                                  <xs:simpleType>
                                    <xs:annotation>
                                      <xs:documentation>Preencher com o valor total da comercialização</xs:documentation>
                                    </xs:annotation>
                                    <xs:restriction base="xs:string">
                                      <xs:minLength value="4"/>
                                      <xs:maxLength value="17" />
                                      <xs:pattern value="[0-9]{1,14}[,][0-9]{2}"/>
                                    </xs:restriction>
                                  </xs:simpleType>
                                </xs:element>
                                <xs:element name="infoProc" minOccurs="0" maxOccurs="50">
                                  <xs:annotation>
                                    <xs:documentation>Informações de processos administrativos/judiciais com decisão/sentença favorável ao contribuinte</xs:documentation>
                                  </xs:annotation>
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="tpProc" minOccurs="1" maxOccurs="1">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>
                                              Preencher com o código correspondente ao tipo de processo:
                                              1 - Administrativo
                                              2 - Judicial;
                                            </xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:unsignedByte">
                                            <xs:pattern value="[1|2]"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                      <xs:element name="nrProc" minOccurs="1" maxOccurs="1">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Informar o número do processo administrativo/judicial.</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:string">
                                            <xs:minLength value="1"/>
                                            <xs:maxLength value="21"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                      <xs:element name="codSusp" minOccurs="0" maxOccurs="1">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>
                                              Código do Indicativo da Suspensão, atribuído pelo contribuinte. Este campo deve ser utilizado se, num mesmo processo,
                                              houver mais de uma matéria tributária objeto de contestação e as decisões forem diferentes para cada uma.
                                            </xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:string">
                                            <xs:pattern value="[0-9]{0,14}"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                      <xs:element name="vlrCPSusp" minOccurs="0" maxOccurs="1">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Valor da Contribuição Previdenciária com exigibilidade suspensa.</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:string">
                                            <xs:minLength value="4"/>
                                            <xs:maxLength value="17" />
                                            <xs:pattern value="[0-9]{1,14}[,][0-9]{2}"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                      <xs:element name="vlrRatSusp" minOccurs="0" maxOccurs="1">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Valor da contribuição para Gilrat com exigibilidade suspensa.</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:string">
                                            <xs:minLength value="4"/>
                                            <xs:maxLength value="17" />
                                            <xs:pattern value="[0-9]{1,14}[,][0-9]{2}"/>
                                          </xs:restriction>
                                        </xs:simpleType>
                                      </xs:element>
                                      <xs:element name="vlrSenarSusp" minOccurs="0" maxOccurs="1">
                                        <xs:simpleType>
                                          <xs:annotation>
                                            <xs:documentation>Valor da contribuição para o Senar com exigibilidade suspensa.</xs:documentation>
                                          </xs:annotation>
                                          <xs:restriction base="xs:string">
                                            <xs:minLength value="4"/>
                                            <xs:maxLength value="17" />
                                            <xs:pattern value="[0-9]{1,14}[,][0-9]{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" use="required">
              <xs:annotation>
                <xs:documentation>Identificação única do evento.</xs:documentation>
              </xs:annotation>
              <xs:simpleType>
                <xs:restriction base="xs:ID">
                  <xs:length value="36" />
                  <xs:pattern value="I{1}D{1}[0-9]{34}" />
                </xs:restriction>
              </xs:simpleType>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element ref="ds:Signature"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>