<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml">
	<xs:include schemaLocation="http://localhost/elend/etranshared/SBA_ETranTypes.xsd"/>
	<xs:include schemaLocation="http://localhost/library/xml/SBA_SimpleTypes.xsd"/>

<!-- Except for MetaData block, the following XML is what the OrigStat method currently returns. SRS, 07/16/2023. -->

<!--
<?xml version="1.0" encoding="UTF-8"?>
<SBA_ETran_OrigStat_Response>
    <AuthErrorNmb>0</AuthErrorNmb>
    <AuthErrorText>Login Successful</AuthErrorText>
    <LoanAppStatus>In Compliance Review</LoanAppStatus>
    <LoanAppNmb>10782192</LoanAppNmb>
    <LoanAppNm>S &amp; S Midstream, Inc</LoanAppNm>
    <LoanAppRqstAmt>35000.00</LoanAppRqstAmt>
    <LoanAppRecvDt>2016-12-02 16:06:37.0</LoanAppRecvDt>
    <LoanAppAppvDt></LoanAppAppvDt>
    <LoanAppSBAAppvAmt></LoanAppSBAAppvAmt>
    <LoanNmb></LoanNmb>
    <LoanGntyFeeAmt></LoanGntyFeeAmt>
    <LoanAppFundDt></LoanAppFundDt>
    <SBAOfcCd></SBAOfcCd>
    <SBAOfc1Nm></SBAOfc1Nm>
    <SBAOfc2Nm></SBAOfc2Nm>
    <SBAOfcStrNm></SBAOfcStrNm>
    <SBAOfcStr2Nm></SBAOfcStr2Nm>
    <SBAOfcCtyNm></SBAOfcCtyNm>
    <SBAOfcTypCd></SBAOfcTypCd>
    <StCd></StCd>
    <ZipCd4></ZipCd4>
    <ZipCd5></ZipCd5>
    <ComplianceCheckDetails>
        <Information>For further assistance with the compliance check codes contact the SBA center at 7aQuestions@sba.gov</Information>
        <Alert>
            <EntityType>Business</EntityType>
            <TaxID>865097756</TaxID>
            <Name>NS test Meta</Name>
            <AlertDetails>Unable to verify business name, address, TIN and phone on business records; The input business TIN is not found; </AlertDetails>
        </Alert>
        <Alert>
            <EntityType>Business</EntityType>
            <TaxID>483706567</TaxID>
            <Name>NS test Master, LLC</Name>
            <AlertDetails>Unable to verify business TIN on business records; The input business TIN is not found; </AlertDetails>
        </Alert>
        <Alert>
            <EntityType>Business</EntityType>
            <TaxID>995886673</TaxID>
            <Name>NS City LLC</Name>
            <AlertDetails>Unable to verify business TIN on business records; The input business TIN is not found; </AlertDetails>
        </Alert>
    </ComplianceCheckDetails>
    <ValidationErrors>
        <Error>
            <ErrorCode>4269</ErrorCode>
            <ErrorText>Alerts are found for the loan</ErrorText>
        </Error>
    </ValidationErrors>
    <ValidationWarnings>
        <Warning>
            <WarningCode>3330</WarningCode>
            <WarningText>For Application, Maturity Starts Date is mandatory</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3223</WarningCode>
            <WarningText>For Borrower 1, Furnish option is Mandatory.</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3221</WarningCode>
            <WarningText>For Borrower 1, Business-Total payments less than total amount of credit card purchases is Mandatory.</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3219</WarningCode>
            <WarningText>For Borrower 1, Other Insurance is Mandatory.</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3217</WarningCode>
            <WarningText>For Borrower 1, Dram Shop/Host Liquor Liability Insurance is Mandatory.</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3216</WarningCode>
            <WarningText>For Borrower 1, Product Liability Insurance is Mandatory.</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3215</WarningCode>
            <WarningText>For Borrower 1, Liability Insurance is Mandatory.</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3224</WarningCode>
            <WarningText>For Borrower 1, to Lender within days is Mandatory.</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3218</WarningCode>
            <WarningText>For Borrower 1, Malpractice Insurance is Mandatory.</WarningText>
        </Warning>
        <Warning>
            <WarningCode>4053</WarningCode>
            <WarningText>For Principal 1, Tax ID 0457854125,  the full 9 digit zip code is mandatory for Mailing Address. (Zip Code + 4)</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3341</WarningCode>
            <WarningText>For Principal 1,  Tax ID 0457854125,  Street Number in Physical Addresses is Missing.</WarningText>
        </Warning>
        <Warning>
            <WarningCode>4054</WarningCode>
            <WarningText>For Principal 1, Tax ID 0457854125, the full 9 digit zip code is mandatory for Physical Address. (Zip Code + 4)</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3343</WarningCode>
            <WarningText>For Guarantor 1,  Tax ID 0978545265,  Street Number in Mailing Address is Missing.</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3341</WarningCode>
            <WarningText>For Guarantor 1,  Tax ID 0978545265,  Street Number in Physical Addresses is Missing.</WarningText>
        </Warning>
        <Warning>
            <WarningCode>4053</WarningCode>
            <WarningText>For Guarantor 1, Tax ID 0978545265,  the full 9 digit zip code is mandatory for Mailing Address. (Zip Code + 4)</WarningText>
        </Warning>
        <Warning>
            <WarningCode>4054</WarningCode>
            <WarningText>For Guarantor 1, Tax ID 0978545265, the full 9 digit zip code is mandatory for Physical Address. (Zip Code + 4)</WarningText>
        </Warning>
        <Warning>
            <WarningCode>4053</WarningCode>
            <WarningText>For Borrower 1, Tax ID 0038413641,  the full 9 digit zip code is mandatory for Mailing Address. (Zip Code + 4)</WarningText>
        </Warning>
        <Warning>
            <WarningCode>4054</WarningCode>
            <WarningText>For Borrower 1, Tax ID 0038413641, the full 9 digit zip code is mandatory for Physical Address. (Zip Code + 4)</WarningText>
        </Warning>
        <Warning>
            <WarningCode>4055</WarningCode>
            <WarningText>For Project, the full 9 digit zip code is mandatory for Project Address. (Zip Code + 4)</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3343</WarningCode>
            <WarningText>For Principal 1,  Tax ID 0457854125,  Street Number in Mailing Address is Missing.</WarningText>
        </Warning>
        <Warning>
            <WarningCode>3201</WarningCode>
            <WarningText>For Proceed Type A01, Proceed Description is Mandatory when Proceed Amount is present.</WarningText>
        </Warning>
    </ValidationWarnings>
</SBA_ETran_OrigStat_Response>
-->

	<!--
	xs:complexType definitions, in reverse-inclusion order, so that each element's type will be defined before the element that uses that type. 
	XSDs don't require "define it before you use it", but it does speed processing. Except for Record, all maxOccurs are the default, 1. 
	This is the first version of the XSD. Except for possible spelling/capitalization errors, it may be the first version that's correct. :-) 
	Not tested yet with the validator built into Developer Utilities > Tester Files > Web Services > ELend (q.v.). SRS, 07/20/2023. 
	-->

	<xs:complexType name="Alert">
		<xs:all>
			<xs:element name="EntityType"					type="xs:string"/>		<!-- Displayable contents of Alert. -->
			<xs:element name="TaxID"						type="xs:int"/>			<!-- Displayable contents of Alert. -->
			<xs:element name="Name"							type="xs:string"/>		<!-- Displayable contents of Alert. -->
			<xs:element name="AlertDetails"					type="xs:string"/>		<!-- Displayable contents of Alert. -->
		</xs:all>
	</xs:complexType>
	<xs:complexType name="ComplianceCheckDetails">
		<xs:all>
			<xs:element name="Alert" maxOccurs="unbounded"	type="xs:string"/>			<!-- A ComplianceCheckDetails element contains arbitrarily many of Alert elements. -->
		</xs:all>
	</xs:complexType>

	<xs:complexType name="Error">
		<xs:all>
			<xs:element name="ErrorCode"					type="xs:int"/>		<!-- Displayable contents of Error. -->
			<xs:element name="ErrorText"					type="xs:string"/>			<!-- Displayable contents of Error. -->
		</xs:all>
	</xs:complexType>
	<xs:complexType name="ValidationErrors">
		<xs:all>
			<xs:element name="Error" maxOccurs="unbounded"	type="xs:string"/>			<!-- A ValidationErrors element contains arbitrarily many of Error elements. -->
		</xs:all>
	</xs:complexType>

	<xs:complexType name="Warning">
		<xs:all>
			<xs:element name="WarningCode"					type="xs:int"/>		<!-- Displayable contents of Warning. -->
			<xs:element name="WarningText"					type="xs:string"/>			<!-- Displayable contents of Warning. -->
		</xs:all>
	</xs:complexType>
	<xs:complexType name="ValidationWarnings">
		<xs:all>
			<xs:element name="Warning" maxOccurs="unbounded"	type="xs:string"/>			<!-- A ValidationWarnings element contains arbitrarily many of Warning elements. -->
		</xs:all>
	</xs:complexType>

	<xs:complexType name="SBA_OrigStat_Response">
		<xs:choice minOccurs="0" maxOccurs="1">
			<xs:element name="AuthErrorNmb"					type="xs:int"/>			<!-- Feedback about the login process when OrigStat was requested, numeric code. -->
			<xs:element name="AuthErrorText"				type="xs:string"/>		<!-- Feedback about the login process when OrigStat was requested, plain text. -->
			<xs:element name="LoanAppStatus"				type="SBA_OrigStatCd"/>	<!-- A 2-letter code indicating the current status of the loan application. -->
			<xs:element name="LoanAppNmb"					type="xs:int"/>			<!-- The SBA loan application number requested. -->
			<xs:element name="LoanAppNm"					type="xs:string"/>		<!-- Name of loan application, generated from its primary borrower. -->
			<xs:element name="LoanAppRqstAmt"				type="SBA_Money"/>		<!-- The requested amount of the loan. -->
			<xs:element name="LoanAppRecvDt"				type="SBA_Date"/>		<!-- The date the app was received. -->
			<xs:element name="LoanAppAppvDt"				type="SBA_Date"/>		<!-- The date the app was approved. -->
			<xs:element name="LoanAppSBAAppvAmt"			type="SBA_Money"/>		<!-- The requested amount of the loan at the time it was approved. -->
			<xs:element name="LoanNmb"						type="xs:int"/>			<!-- If loan application has been funded, the loan number the SBA assigned to it. -->
			<xs:element name="LoanGntyFeeAmt"				type="SBA_Money"/>		<!-- If app is guaranty (not direct), the fee calculated from app's characteristics. -->
			<xs:element name="LoanAppFundDt"				type="SBA_Date"/>		<!-- If app has been funded, the date it was funded. -->
			<xs:element name="SBAOfcCd"						type="SBA_Num4"/>		<!-- 4 digit code identifying the SBA office to which the loan was assigned. -->
			<xs:element name="SBAOfc1Nm"					type="xs:string"/>		<!-- Name of SBAOfcCd (above): main name of that office. -->
			<xs:element name="SBAOfc2Nm"					type="xs:string"/>		<!-- Name of SBAOfcCd (above): secondary name of that office. -->
			<xs:element name="SBAOfcStrNm"					type="xs:string"/>		<!-- Address of SBAOfcCd (above): street address line 1. -->
			<xs:element name="SBAOfcStr2Nm"					type="xs:string"/>		<!-- Address of SBAOfcCd (above): street address line 2. -->
			<xs:element name="SBAOfcCtyNm"					type="xs:string"/>		<!-- Address of SBAOfcCd (above): city. -->
			<xs:element name="SBAOfcTypCd"					type="xs:string"/>		<!-- Office type code of SBAOfcCd (above). -->
			<xs:element name="StCd"							type="SBA_StateCode"/>	<!-- Address of SBAOfcCd (above): US Postal Service state code. -->
			<xs:element name="ZipCd4"						type="xs:int"/>			<!-- Address of SBAOfcCd (above): US Postal Service Zip+4 code (if known). -->
			<xs:element name="ZipCd5"						type="xs:int"/>			<!-- Address of SBAOfcCd (above): US Postal Service Zip code. -->
			<xs:element name="ComplianceCheckDetails"		type="ComplianceCheckDetails"/>		<!-- Expansion of elements to support compliance fields. -->
			<xs:element name="ValidationErrors"		type="ValidationErrors"/>		<!-- Expansion of elements to support validation errors. -->
			<xs:element name="ValidationWarnings"		type="ValidationWarnings"/>		<!-- Expansion of elements to support validation warnings. -->
			<xs:element name="Information"					type="xs:string"/>		<!-- Informationm For further assistance with the compliance check . -->
		</xs:choice>
	</xs:complexType>

	<!-- xs:element definitions: -->

	<xs:element name="SBA_ETran_OrigStat_Response">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="SBA_ETran_OrigStat_Response" type="SBA_OrigStat_Response"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

</xs:schema>