<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.gnre.pe.gov.br" 
	elementFormDefault="qualified" 
	attributeFormDefault="unqualified" 
	xmlns:xs="http://www.w3.org/2001/XMLSchema" 
	xmlns="http://www.gnre.pe.gov.br" >
	<xs:include schemaLocation="dados_gnre_v1.00.xsd"/>
	<xs:include schemaLocation="dados_gnre_v2.00.xsd"/>
	<xs:group name="dadosGnre_1.00">
		<xs:sequence>
	       	<xs:group ref="dadosGnre_1.00_1"/>
 			<xs:element minOccurs="0" name="c07_atualizacaoMonetaria" type="TDec_1502">
				<xs:annotation>
					<xs:documentation>Atualização monetária do valor original até a data de pagamento.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element minOccurs="0" name="c08_juros" type="TDec_1502">
				<xs:annotation>
					<xs:documentation>Valor de juros sobre o valor original até a data de pagamento.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element minOccurs="0" name="c09_multa" type="TDec_1502">
				<xs:annotation>
					<xs:documentation>Valor da multa aplicada sobre o valor original.</xs:documentation>
				</xs:annotation>
			</xs:element>
	       	<xs:group ref="dadosGnre_1.00_2"/>
			<xs:element minOccurs="0" name="c29_dataLimitePagamento" type="TData">
				<xs:annotation>
					<xs:documentation>Data máxima que o banco pode receber o pagamento, que estará impressa na guia e no código de barras.</xs:documentation>
				</xs:annotation>
			</xs:element>
	       	<xs:group ref="dadosGnre_1.00_3"/>
			<xs:element minOccurs="0" name="c23_informacoes">
			<xs:annotation>
				<xs:documentation>Informação complementar a ser impressa na guia.</xs:documentation>
			</xs:annotation>
			<xs:simpleType>
				<xs:restriction base="TString">
				<xs:maxLength value="300" />
				</xs:restriction>
			</xs:simpleType>
			</xs:element>
           	<xs:element minOccurs="0" name="c30_nossoNumero">
           		<xs:annotation>
           			<xs:documentation>
           				Número interno da guia gerado pela UF
           			</xs:documentation>
           		</xs:annotation>
           		<xs:simpleType>
           			<xs:restriction base="xs:string">
           				<xs:whiteSpace value="preserve" />
           				<xs:pattern value="[0-9]{16}" />
           			</xs:restriction>
           		</xs:simpleType>
           	</xs:element>
	       	<xs:group ref="dadosGnre_1.00_4"/>
	    </xs:sequence>
	</xs:group>
	<xs:group name="dadosGnre_2.00">
		<xs:sequence>
			<xs:group ref="dadosGnre_2.00_1"/>
			<xs:group ref="dadosGnre_2.00_2_retorno" />
			<xs:group ref="dadosGnre_2.00_3" />
		</xs:sequence>
	</xs:group>
	<xs:group name="resultadoGuia">
		<xs:sequence>
			<xs:element name="linhaDigitavel" maxOccurs="1"
				minOccurs="0">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:pattern value="\d{48}"></xs:pattern>
					</xs:restriction>
				</xs:simpleType>
			</xs:element>
			<xs:element name="codigoBarras" maxOccurs="1"
				minOccurs="0">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:pattern value="\d{44}"></xs:pattern>
					</xs:restriction>
				</xs:simpleType>
			</xs:element>
			<xs:element minOccurs="0" name="qrcodePayload">
				<xs:annotation>
					<xs:documentation>String PIX, texto copia e cola, utilizado na geracao do qrcode.</xs:documentation>
				</xs:annotation>
				<xs:simpleType>
					<xs:restriction base="TString">
						<xs:whiteSpace value="preserve" />
						<xs:maxLength value="512"></xs:maxLength>
						<xs:minLength value="100"></xs:minLength>
					</xs:restriction>
				</xs:simpleType>
			</xs:element>
			<xs:element name="motivosRejeicao" maxOccurs="1" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
			           <xs:element name="motivo" maxOccurs="unbounded" minOccurs="0">
							<xs:complexType>
								<xs:sequence>
									<xs:element name="codigo" maxOccurs="1" minOccurs="1">
										<xs:simpleType>
											<xs:restriction base="xs:string">
												<xs:pattern value="\d{3}"></xs:pattern>
											</xs:restriction>
										</xs:simpleType>
									</xs:element>
									<xs:element name="descricao" maxOccurs="1" minOccurs="1">
										<xs:simpleType>
											<xs:restriction base="xs:string">
												<xs:maxLength value="355"></xs:maxLength>
											</xs:restriction>
										</xs:simpleType>
									</xs:element>
									<xs:element name="campo" maxOccurs="1" minOccurs="0">
										<xs:simpleType>
											<xs:restriction base="xs:string">
												<xs:maxLength value="30"></xs:maxLength>
											</xs:restriction>
										</xs:simpleType>
									</xs:element>
								</xs:sequence>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
        </xs:sequence>
	</xs:group>
	<xs:element name="TResultLote_GNRE">
    	<xs:complexType>
    		<xs:sequence>
    			<xs:element name="ambiente" maxOccurs="1" minOccurs="1">
    				<xs:simpleType>
    					<xs:restriction base="xs:string">
    						<xs:enumeration value="1"></xs:enumeration>
    						<xs:enumeration value="2"></xs:enumeration>
    					</xs:restriction>
    				</xs:simpleType>
    			</xs:element>
    			<xs:element name="numeroRecibo" minOccurs="0">
    				<xs:simpleType>
    					<xs:restriction base="xs:string">
    						<xs:pattern value="[0-9]{10}"></xs:pattern>
    					</xs:restriction>
    				</xs:simpleType>
    			</xs:element>
    			<xs:element name="situacaoProcess" maxOccurs="1" minOccurs="1">
    				<xs:complexType>
    					<xs:sequence>
    						<xs:element name="codigo" maxOccurs="1" minOccurs="1">
    							<xs:simpleType>
    								<xs:restriction base="xs:string">
    									<xs:pattern
    										value="[1-9][0-9]{2}">
    									</xs:pattern>
    								</xs:restriction>
    							</xs:simpleType>
    						</xs:element>
    						<xs:element name="descricao" maxOccurs="1" minOccurs="1">
    							<xs:simpleType>
    								<xs:restriction base="xs:string">
    									<xs:maxLength value="255"></xs:maxLength>
    								</xs:restriction>
    							</xs:simpleType>
    						</xs:element>
    					</xs:sequence>
    				</xs:complexType>
    			</xs:element>
    			<xs:element name="resultado" maxOccurs="1" minOccurs="0" >
    				<xs:complexType>
						<xs:sequence>
							<xs:element name="guia" minOccurs="1"
								maxOccurs="200">
								<xs:complexType>
									<xs:sequence>
                                    	<xs:element name="situacaoGuia" maxOccurs="1" minOccurs="1">
											<xs:annotation>
												<xs:documentation>
													0 - Processada com sucesso 
													1 - Invalidada pelo	Portal 
													2 - Invalidada pela UF 
													3 - Erro de	comunicação
													4 - Pendencia de processamento
												</xs:documentation>
											</xs:annotation>
											<xs:simpleType>
												<xs:restriction base="xs:string">
													<xs:enumeration value="0"></xs:enumeration>
													<xs:enumeration value="1"></xs:enumeration>
													<xs:enumeration value="2"></xs:enumeration>
													<xs:enumeration value="3"></xs:enumeration>
													<xs:enumeration value="4"></xs:enumeration>
												</xs:restriction>
											</xs:simpleType>
										</xs:element>
                                        <xs:choice>
                                        	<xs:sequence>
												<xs:group
													ref="dadosGnre_1.00" />
											</xs:sequence>
                                            <xs:sequence>
												<xs:group
													ref="dadosGnre_2.00" />
												<xs:element minOccurs="0" name="dataLimitePagamento"
													type="TData">
													<xs:annotation>
														<xs:documentation>
															Data máxima que o banco pode receber o
															pagamento, que estará impressa na guia e no
															código de barras.
														</xs:documentation>
													</xs:annotation>
												</xs:element>
												<xs:element minOccurs="0"
													name="informacoesComplementares">
													<xs:annotation>
														<xs:documentation>
															Informação complementar a ser impressa na guia.
														</xs:documentation>
													</xs:annotation>
													<xs:complexType>
														<xs:sequence>
															<xs:element name="informacao" minOccurs="1"
																maxOccurs="3">
																<xs:simpleType>
																	<xs:restriction base="TString">
																		<xs:maxLength value="100" />
																		<xs:minLength value="1" />
																	</xs:restriction>
																</xs:simpleType>
															</xs:element>
														</xs:sequence>
													</xs:complexType>
													<!-- <xs:simpleType>
														<xs:restriction base="TString">
														<xs:maxLength value="300" />
														</xs:restriction>
														</xs:simpleType> -->
												</xs:element>
												<xs:element minOccurs="0" name="nossoNumero">
													<xs:annotation>
														<xs:documentation>
															Número interno da guia gerado pela UF
														</xs:documentation>
													</xs:annotation>
													<xs:simpleType>
														<xs:restriction base="xs:string">
															<xs:whiteSpace value="preserve" />
															<xs:pattern value="[0-9]{16}" />
														</xs:restriction>
													</xs:simpleType>
												</xs:element>
											</xs:sequence>
										</xs:choice>
										<xs:group
											ref="resultadoGuia" />
									</xs:sequence>
									<xs:attribute
										name="versao" use="required">
										<xs:simpleType>
											<xs:restriction
												base="xs:string">
												<xs:enumeration
													value="1.00">
												</xs:enumeration>
												<xs:enumeration
													value="2.00">
												</xs:enumeration>
											</xs:restriction>
										</xs:simpleType>
									</xs:attribute>
								</xs:complexType>
							</xs:element>
							<xs:element name="pdfGuias" minOccurs="0" maxOccurs="1"></xs:element>
							<xs:element name="arquivoPagamento" minOccurs="0" maxOccurs="1"></xs:element>
							<xs:element name="noticias" minOccurs="0" maxOccurs="1">
								<xs:complexType>
									<xs:sequence>
										<xs:element name="noticia" minOccurs="0" maxOccurs="unbounded">
											<xs:complexType>
												<xs:sequence>
													<xs:element name="dhPublicacao" type="TDataHora" maxOccurs="1" minOccurs="1">
						                                <xs:annotation>
						                                	<xs:documentation>Data e Hora da publicacao da noticia</xs:documentation>
						                                </xs:annotation>			                                
													</xs:element>
													<xs:element name="titulo" minOccurs="1" maxOccurs="1" type="xs:string" />
													<xs:element name="texto" minOccurs="1" maxOccurs="1" type="xs:string" />			
												</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:schema>