<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         elementFormDefault="qualified"
         attributeFormDefault="unqualified"
         version="1.4">
  <xsd:annotation>
    <xsd:appinfo>NYS DOH Opioid Annual Technical Report and File Specifications. Version 1.4</xsd:appinfo>
    <xsd:documentation>
      <p>This technical document is to be used by manufacturers/distributers of opioids to report the total morphine milligram equivalent amount and other required data elements for opioids sold into
        or within New York State for a given calendar year.
      </p>
      <h3>Definitions of terms used in this schema</h3>
      <dl>
        <dt>DEA</dt>
        <dd>- U.S. Drug Enforcement Agency</dd>
        <dt>MME</dt>
        <dd>- Morphine Milligram Equivalent</dd>
        <dt>NYS</dt>
        <dd>- New York State</dd>
        <dt>DOH</dt>
        <dd>- NYS Department of Health</dd>
        <dt>SED</dt>
        <dd>- New York State Education Department</dd>
        <dt>Registrant</dt>
        <dd>- The manufacturer/distributer selling opioids into or within NYS. A reporter is uniquely identified by its DEA registration number and/or SED registration number and/or its NYS Controlled
          Substance License number
        </dd>
        <dt>NDC</dt>
        <dd>- National Drug Code</dd>
        <dt>Reportable</dt>
        <dd>All transactions of opioids by the reporter as detailed in the ‘New York State Department of Health Opioid Annual Report Guidance’ document.</dd>
      </dl>
      <p>All information in this report is limited to opioid transactions (including sales, returns, credits, and cancellations) of a finished opioid unit by a registrant into or within NYS for the transaction year being reported.</p>
      <h3>Multiple Field Validation</h3>
      <p>The following validations rules are not enforced in within this XSD but will be enforced when a report is submitted.</p>
      <ol>
      <li>The SellerTransactionId must be unique for every OpioidSale submitted in this report</li>
      <li>An OpioidSale must have at least one of the following attributes filled: SellerDeaNumber, SellerCsLicenseNumber, SellerSedLicense</li>
      <li>A SellerDeaNumber, SellerCsLicenseNumber, SellerSedLicense combination found in an OpioidSale must also appear in the RegistrantLicensesList</li>
      <li>For 'S' (Sale) transactions, attributes Containers, TotalMetricQuantity and TotalNyMMEs must be greater than 0. TransactionGrossReceipt must be 0 or greater </li>
      <li>For 'R' (Return/Credit/Cancellation) transactions, attributes Containers, TotalMetricQuantity and TotalNyMMEs must be less than 0. TransactionGrossReceipt must be 0 or less </li>
      <li>The OpioidSale TransactionDate must be within the TransactionYear </li>
      </ol>
    </xsd:documentation>
  </xsd:annotation>

  <xsd:element name="OpioidTaxReportingData" type="OpioidTaxReportingDataType">
    <xsd:annotation>
      <xsd:documentation>
        NYS Opioid Tax Reporting Data
      </xsd:documentation>
    </xsd:annotation>
  </xsd:element>

  <xsd:complexType name="OpioidTaxReportingDataType">
    <xsd:annotation>
      <xsd:documentation>
        NYS Opioid Tax Reporting Data
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:element name="RegistrantYearlyReport" type="RegistrantYearlyReportType" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            NYS Opioid Tax Report by a Registrant for a reporting year
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="RegistrantYearlyReportType">
    <xsd:sequence>
      <xsd:element name="Registrant" type="RegistrantType" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            Registrant. The taxable entity who is legally required to submit this report.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Submitter" type="SubmitterType" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            Submitter Information. The person responsible for submitting the data and who should be contacted for any submission issues.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="RegistrantLicensesList" type="RegistrantLicensesType" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            List of license combinations (SED, DOH, DEA) used by the registrant.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="OpioidSales" type="OpioidSalesType" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            List of opioid transactions sold by or returned to the Registrant for the reporting year.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute name="TIN" use="required" type="tinType">
      <xsd:annotation>
        <xsd:documentation>
          Taxpayer Identification Number (FEIN or EIN assigned by the Internal Revenue Service)
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="TransactionYear" use="required" type="transactionYearType">
      <xsd:annotation>
        <xsd:documentation>
          The year in which the transaction occurred (e.g. 2019)
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:complexType name="RegistrantType">
    <xsd:sequence>
    </xsd:sequence>
    <xsd:attribute name="Name" use="required" type="entityNameType">
      <xsd:annotation>
        <xsd:documentation>
          Corporate Name Associated with Taxpayer Identification Number (TIN)
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="AddressLine1" use="required" type="addressLineType">
      <xsd:annotation>
        <xsd:documentation>
          Corporate Address associated with TIN
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="AddressLine2" use="optional" type="addressLineType">
      <xsd:annotation>
        <xsd:documentation>
          Corporate Address associated with TIN
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="AddressLine3" use="optional" type="addressLineType">
      <xsd:annotation>
        <xsd:documentation>
          Corporate Address associated with TIN
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="City" use="required" type="cityType">
      <xsd:annotation>
        <xsd:documentation>
          Corporate City associated with TIN
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="State" use="required" type="stateType">
      <xsd:annotation>
        <xsd:documentation>
          Corporate State associated with TIN
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="Zip5" use="required" type="zip5Type">
      <xsd:annotation>
        <xsd:documentation>
          Corporate First 5 of the Zip Code associated with TIN
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="Zip4" use="optional" type="zip4Type">
      <xsd:annotation>
        <xsd:documentation>
          Corporate Zip 4 associated with TIN
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="Email" use="optional" type="emailType">
      <xsd:annotation>
        <xsd:documentation>
          Corporate Email associated with TIN
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="PhoneAreaCode"  use="required" type="phonePrefixType">
      <xsd:annotation>
        <xsd:documentation>
          Corporate Phone Number area code associated with TIN
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="PhonePrefix" use="required" type="phonePrefixType">
      <xsd:annotation>
        <xsd:documentation>
          Corporate Phone Number (first 3 digits) associated with TIN
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="PhoneSuffix" use="required" type="phoneSuffixType">
      <xsd:annotation>
        <xsd:documentation>
          Corporate Phone Number (last 4 digits) associated with TIN
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="PhoneExtension" use="optional" type="phoneExtType">
      <xsd:annotation>
        <xsd:documentation>
          Corporate Phone Number (extension) associated with TIN
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:complexType name="SubmitterType">
    <xsd:sequence>
    </xsd:sequence>
    <xsd:attribute name="FirstName" use="required" type="personNameType">
      <xsd:annotation>
        <xsd:documentation>
          First name of person to contact for questions related to the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="LastName" use="required" type="personNameType">
      <xsd:annotation>
        <xsd:documentation>
          Last name of person to contact for questions related to the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="AddressLine1" use="required" type="addressLineType">
      <xsd:annotation>
        <xsd:documentation>
          Address of person to contact regarding the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="AddressLine2" use="optional" type="addressLineType">
      <xsd:annotation>
        <xsd:documentation>
          Address of person to contact regarding the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="AddressLine3" use="optional" type="addressLineType">
      <xsd:annotation>
        <xsd:documentation>
          Address of person to contact regarding the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="City" use="required" type="cityType">
      <xsd:annotation>
        <xsd:documentation>
          City of person to contact regarding the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="State" use="required" type="stateType">
      <xsd:annotation>
        <xsd:documentation>
          State of person to contact regarding the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="Zip5" use="required" type="zip5Type">
      <xsd:annotation>
        <xsd:documentation>
          First 5 of the Zip Code of person to contact regarding the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="Zip4" use="optional" type="zip4Type">
      <xsd:annotation>
        <xsd:documentation>
          Zip 4 of person to contact regarding the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="Email" use="required" type="emailType">
      <xsd:annotation>
        <xsd:documentation>
          Email of person to contact regarding the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="PhoneAreaCode" use="required" type="phonePrefixType">
      <xsd:annotation>
        <xsd:documentation>
          Phone Number area code of person to contact regarding the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="PhonePrefix" use="required" type="phonePrefixType">
      <xsd:annotation>
        <xsd:documentation>
          Phone Number (first 3 digits) of person to contact regarding the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="PhoneSuffix" use="required" type="phoneSuffixType">
      <xsd:annotation>
        <xsd:documentation>
          Phone Number (last 4 digits) of person to contact regarding the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="PhoneExtension" use="optional" type="phoneExtType">
      <xsd:annotation>
        <xsd:documentation>
          Phone Number (extension) of person to contact regarding the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:complexType name="OpioidSaleType">
    <xsd:sequence>
      <xsd:element name="SellerTransactionId" minOccurs="1" maxOccurs="1" type="maxLength4000Type">
        <xsd:annotation>
          <xsd:documentation>
            Transaction ID assigned to each opioid transaction(must be a unique value per Reporting Year)
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="SellerInvoice" minOccurs="1" maxOccurs="1" type="maxLength4000Type">
        <xsd:annotation>
          <xsd:documentation>
            Invoice number on sales transaction
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="SellerDeaNumber" minOccurs="0" maxOccurs="1" type="wholesaleDeaType">
        <xsd:annotation>
          <xsd:documentation>
            DEA registration number, if applicable, for the registrant that sold the opioid
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="SellerCsLicenseNumber" minOccurs="0" maxOccurs="1" type="wholesaleCslType">
        <xsd:annotation>
          <xsd:documentation>
            NYS DOH controlled substance license number, if applicable, for the registrant that sold the opioid
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="SellerSedLicense" minOccurs="0" maxOccurs="1" type="pharmNYSedType">
        <xsd:annotation>
          <xsd:documentation>
            State Education Department registration number, if applicable, for the registrant that sold the opioid
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="BuyerDeaNumber" minOccurs="1" maxOccurs="1" type="allDeaType">
        <xsd:annotation>
          <xsd:documentation>
            DEA registration number of the buyer
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="BuyerCsLicenseNumber" minOccurs="0" maxOccurs="1" type="allCslType">
        <xsd:annotation>
          <xsd:documentation>
            NYS DOH controlled substance license number, if applicable, of the buyer
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="BuyerDeaName" minOccurs="1" maxOccurs="1" type="deaNameAddrLineType">
        <xsd:annotation>
          <xsd:documentation>
            The name of the buyer as it appears on the DEA Registration
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="BuyerDeaAddress" type="BuyerDeaAddressType" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            Buyer's DEA Registered Address
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="BuyerType" minOccurs="1" maxOccurs="1" type="buyerType">
        <xsd:annotation>
          <xsd:documentation>
            Buyer Classification:
            '32' - buyers operating pursuant to Article 32 of Mental Hygiene Law,
            '40' - buyers operating pursuant to Article 40 of Public Health Law,
            '99' - buyers
            located out of NYS,
            '49' - all other buyers
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="TransactionDate" type="xsd:date" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            Date transaction occurred
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="TransactionType" type="TransactionTypeType" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            S for Sale, R for Return/Credit/Cancellation.
            If the type is R, then you must supply the OriginalSaleDate and the OriginalSaleInvoice
            If the type is S, then OriginalSaleDate and OriginalSaleInvoice should not be supplied
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="TransactionGrossReceipt" minOccurs="1" maxOccurs="1" type="money10Type">
        <xsd:annotation>
          <xsd:documentation>
            Gross receipt total for the opioid transaction (in US Dollars)
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="IsFirstSale" type="firstSaleTypeType" minOccurs="1" maxOccurs="1" >
        <xsd:annotation>
          <xsd:documentation>
            Was this the first sale within or into New York State, 'Y' for yes, 'N' for no

            (A first sale is any transfer of title to an opioid unit for consideration where actual or
            constructive possession of such opioid unit is transferred by a registrant holding title to such opioid
            unit to a purchaser or its designee in this state for the first time.)

          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="NdcCode" minOccurs="1" maxOccurs="1" type="ndcNumberType">
        <xsd:annotation>
          <xsd:documentation>
            11-digit National Drug Code (NDC) identifying the opioid sold (include leading zeros’s)
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="DrugName" minOccurs="1" maxOccurs="1" type="drugNameType">
        <xsd:annotation>
          <xsd:documentation>
            Name of the drug as registered with the Food and Drug Administration
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="StrengthPerUnit" minOccurs="1" maxOccurs="1" type="number10-4Type">
        <xsd:annotation>
          <xsd:documentation>
            Amount of opioid in a unit, as measured by weight, volume, concentration or other measure
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="UnitsPerContainer" minOccurs="1" maxOccurs="1" type="number10-4Type">
        <xsd:annotation>
          <xsd:documentation>
            Number of units in the saleable container as identified by the 11-digit NDC Code
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="Containers" minOccurs="1" maxOccurs="1" type="plusMinusNumber10-4Type">
        <xsd:annotation>
          <xsd:documentation>
            Number of containers in this transaction
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="TotalMetricQuantity" minOccurs="1" maxOccurs="1" type="plusMinusNumber10-4Type">
        <xsd:annotation>
          <xsd:documentation>
            Units per container multiplied by the number of containers sold
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="MmeConversionFactor" minOccurs="1" maxOccurs="1" type="number10-4Type">
        <xsd:annotation>
          <xsd:documentation>
            Reference standard of a particular opioid as it relates in potency to morphine as determined by the Commissioner of Health
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="TotalNyMMEs" minOccurs="1" maxOccurs="1" type="plusMinusNumber12-4Type">
        <xsd:annotation>
          <xsd:documentation>
            Total Morphine Milligram Equivalent's in transaction
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="IsOverWacThreshold" type="isWacThresholdType" minOccurs="1" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            Is the wholesale acquisition cost equal to or greater than $0.50? 'Y' for yes, 'N' for no
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="OpioidSalesType">
    <xsd:sequence>
      <xsd:element name="OpioidSale" type="OpioidSaleType" minOccurs="0" maxOccurs="unbounded">
        <xsd:annotation>
          <xsd:documentation>
            Information about a specific drug (idenfitied by an NDC number) involved in a sale/return transaction.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="TransactionTypeType">
    <xsd:sequence>
      <xsd:element name="OriginalSaleDate" type="xsd:date" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            If Transaction Type is a return, reference the transaction date of the original sale of opioid.
            <br />
            If Transaction Type is a sale, leave this field blank.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
      <xsd:element name="OriginalSaleInvoice" minOccurs="0" maxOccurs="1" type="maxLength4000Type">
        <xsd:annotation>
          <xsd:documentation>
            If Transaction Type is a return, reference the invoice number of the original sale of opioid.
            <br />
            If Transaction Type is a sale, leave this field blank.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute name="Type" use="required" type="saleType">
      <xsd:annotation>
        <xsd:documentation>
          S for Sale, R for Return/Credit/Cancellation
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:complexType name="BuyerDeaAddressType">
    <xsd:attribute name="Line1" use="required" type="deaNameAddrLineType">
      <xsd:annotation>
        <xsd:documentation>
          The 1st line of the address of the buyer as it appears on the DEA Registration
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="Line2" use="optional" type="deaNameAddrLineType">
      <xsd:annotation>
        <xsd:documentation>
          The 2nd line of the address of the buyer as it appears on the DEA Registration
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="Line3" use="optional" type="deaNameAddrLineType">
      <xsd:annotation>
        <xsd:documentation>
          The 3rd line of the address of the buyer as it appears on the DEA Registration
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="City" use="required" type="cityType">
      <xsd:annotation>
        <xsd:documentation>
          The city of the buyer as it appears on the DEA Registration
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="State" use="required" type="stateType">
      <xsd:annotation>
        <xsd:documentation>
          The state of the buyer as it appears on the DEA Registration
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="Zip5" use="required" type="usZip5Type">
      <xsd:annotation>
        <xsd:documentation>
          The first five digits of the zip code of the buyer as it appears on the DEA Registration
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="Zip4" use="optional" type="usZip4Type">
      <xsd:annotation>
        <xsd:documentation>
          The zip plus 4 of the buyer as it appears on the DEA Registration
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:complexType name="RegistrantLicensesType">
    <xsd:sequence>
      <xsd:element name="RegistrantLicense" type="RegistrantLicenseType" minOccurs="1" maxOccurs="unbounded">
       <xsd:annotation>
        <xsd:documentation>
          Combination of registrations/licenses (SED, CSL, DEA) for all registrants that operate under one Corporate Taxpayer Identification Number
        </xsd:documentation>
      </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="RegistrantLicenseType">
    <xsd:sequence></xsd:sequence>
    <xsd:attribute name="DEANumber" use="optional" type="wholesaleDeaType">
      <xsd:annotation>
        <xsd:documentation>
          DEA registration number, if applicable, for each registrant included in the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="CSLicense" use="optional" type="wholesaleCslType">
      <xsd:annotation>
        <xsd:documentation>
          NYS DOH controlled substance license number, if applicable, for each registrant included in the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="SEDLicense" use="optional" type="pharmNYSedType">
      <xsd:annotation>
        <xsd:documentation>
          NYS Education Department registration number, if applicable, for each registrant included in the annual report
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="LicenseeCorporateName" use="required" type="licenseeCorporateName">
      <xsd:annotation>
        <xsd:documentation>
          DEA registration name if available, otherwise, corporate name as displayed on license/registration certificate(CS or SED)
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:simpleType name="tinType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[0-9,T,N][0-9,F,Y]\d{7}[0-9,A-Z]?[0-9,S]?"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="entityNameType">
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="2"></xsd:minLength>
      <xsd:maxLength value="120"></xsd:maxLength>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="transactionYearType">
    <xsd:restriction base="xsd:int">
      <xsd:minInclusive value="2019"></xsd:minInclusive>
      <xsd:maxExclusive value="9999"></xsd:maxExclusive>
      <xsd:pattern value="\d{4}"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="addressLineType">
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="2"></xsd:minLength>
      <xsd:maxLength value="40"></xsd:maxLength>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="cityType">
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="2"></xsd:minLength>
      <xsd:maxLength value="29"></xsd:maxLength>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="stateType">
    <xsd:restriction base="xsd:string">
      <xsd:length value="2"></xsd:length>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="zip5Type">
    <xsd:restriction base="xsd:string">
      <xsd:length value="5"></xsd:length>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="zip4Type">
    <xsd:restriction base="xsd:string">
      <xsd:length value="4"></xsd:length>
      <xsd:pattern value="\d{4}"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="usZip4Type">
    <xsd:restriction base="xsd:string">
      <xsd:length value="4"></xsd:length>
      <xsd:pattern value="\d{4}"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="emailType">
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="0"></xsd:minLength>
      <xsd:maxLength value="320"></xsd:maxLength>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="personNameType">
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="2"></xsd:minLength>
      <xsd:maxLength value="25"></xsd:maxLength>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="maxLength4000Type">
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="1"></xsd:minLength>
      <xsd:maxLength value="4000"></xsd:maxLength>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="wholesaleDeaType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[PR][A-Z9][0-9]{7}"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="wholesaleCslType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="(010|01A|020|02A|02B|02E|090)[0-9]{4}">
      </xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="pharmNYSedType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[0-9]{6}"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="allDeaType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[ABFGMPR][A-Z9][0-9]{7}"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="allCslType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="(010|01A|020|02A|02B|02E|030|03A|03B|03C|03D|03E|040|04A|050|060|06A|06B|070|080|090|09A|100|10A|110)[0-9]{4}">
      </xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="buyerType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="32"></xsd:enumeration>
      <xsd:enumeration value="40"></xsd:enumeration>
      <xsd:enumeration value="49"></xsd:enumeration>
      <xsd:enumeration value="99"></xsd:enumeration>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="money10Type">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[-+]?\d{1,10}\.?\d{0,2}"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="ndcNumberType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[0-9A-Z*]{11}"></xsd:pattern>
      <xsd:length value="11"></xsd:length>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="drugNameType">
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="2"></xsd:minLength>
      <xsd:maxLength value="100"></xsd:maxLength>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="number10-4Type">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="\d{1,10}\.?\d{0,4}"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="plusMinusNumber10-4Type">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[+-]?\d{1,10}\.?\d{0,4}"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="plusMinusNumber12-4Type">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[+-]?\d{1,12}\.?\d{0,4}"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="saleType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="S"></xsd:enumeration>
      <xsd:enumeration value="R"></xsd:enumeration>
      <xsd:length value="1"></xsd:length>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="phonePrefixType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="\d{3}"></xsd:pattern>
      <xsd:length value="3"></xsd:length>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="phoneSuffixType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="\d{4}"></xsd:pattern>
      <xsd:length value="4"></xsd:length>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="phoneExtType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[A-Za-z0-9*_#]{0,10}"></xsd:pattern>
      <xsd:minLength value="0"></xsd:minLength>
      <xsd:maxLength value="10"></xsd:maxLength>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="deaNameAddrLineType">
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="2"></xsd:minLength>
      <xsd:maxLength value="40"></xsd:maxLength>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="usZip5Type">
    <xsd:restriction base="xsd:string">
      <xsd:length value="5"></xsd:length>
      <xsd:pattern value="\d{5}"></xsd:pattern>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="licenseeCorporateName">
    <xsd:restriction base="xsd:string">
      <xsd:minLength value="1"></xsd:minLength>
      <xsd:maxLength value="150"></xsd:maxLength>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="firstSaleTypeType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="Y"></xsd:enumeration>
      <xsd:enumeration value="N"></xsd:enumeration>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="isWacThresholdType">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="Y"></xsd:enumeration>
      <xsd:enumeration value="N"></xsd:enumeration>
    </xsd:restriction>
  </xsd:simpleType>


</xsd:schema>
