<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://nfse.blumenau.sc.gov.br" 
           xmlns:tipos="http://nfse.blumenau.sc.gov.br/tipos" 
           xmlns:xs="http://www.w3.org/2001/XMLSchema" 
           xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
  <xs:import namespace="http://nfse.blumenau.sc.gov.br/tipos" schemaLocation="TiposNFe_v01.xsd" />
  <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema_v01.xsd" />
  <xs:element name="PedidoConsultaNFe">
    <xs:annotation>
      <xs:documentation>Schema utilizado para PEDIDO de consultas de NFS-e.</xs:documentation>
      <xs:documentation>Este Schema XML é utilizado pelos prestadores de serviços consultarem NFS-e geradas por eles.</xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Cabecalho" minOccurs="1" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>Cabeçalho do pedido.</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:element name="CPFCNPJRemetente" type="tipos:tpCPFCNPJ" minOccurs="1" maxOccurs="1" >
                <xs:annotation>
                  <xs:documentation>Informe o CPF/CNPJ do Remetente autorizado a transmitir a mensagem XML.</xs:documentation>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="Versao" type="tipos:tpVersao" use="required" fixed="1">
              <xs:annotation>
                <xs:documentation>Informe a Versão do Schema XML utilizado.</xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element name="Detalhe" minOccurs="1" maxOccurs="50">
          <xs:annotation>
            <xs:documentation>Detalhe do pedido. Cada item de detalhe deverá conter a chave de uma NFS-e ou a chave de um RPS.</xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:choice>
              <xs:element name="ChaveRPS" type="tipos:tpChaveRPS" minOccurs="1" maxOccurs="1" />
              <xs:element name="ChaveNFe" type="tipos:tpChaveNFe" minOccurs="1" maxOccurs="1" />
            </xs:choice>
          </xs:complexType>
        </xs:element>
        <xs:element ref="ds:Signature" minOccurs="1" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>Assinatura digital do contribuinte que gerou as NFS-e/RPS.</xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>