<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.ansys.com/importoptions"
            xmlns="http://www.ansys.com/importoptions"
            xmlns:stackup="http://www.ansys.com/stackup"
            elementFormDefault="unqualified">

  <xsd:import schemaLocation="Stackup.xsd" namespace="http://www.ansys.com/stackup" />

  <xsd:element name="ImportOptions" type="ImportOptions" />
  <xsd:element name="Nets" type="Nets" />
  <xsd:element name="GDS_NET_DEFINITIONS" type="GDS_NET_DEFINITIONS" />
  <xsd:element name="GDS_CELL_RULES" type="GDS_CELL_RULES" />

  <!-- Type Declarations -->
  
    <xsd:simpleType name="PosInt">
      <xsd:restriction base="xsd:integer">
        <xsd:minInclusive value="0" />
      </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="PortNamingConvention">
        <xsd:attribute name="Value" type="xsd:string" use="required" />
    </xsd:complexType>

  <xsd:simpleType name="NC-Omit-Zeroes">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="TZ"/>
      <xsd:enumeration value="LZ"/>
      <xsd:enumeration value="Trailing"/>
      <xsd:enumeration value="Leading"/>
      <xsd:enumeration value="None"/>
    </xsd:restriction>
  </xsd:simpleType>
  
  <xsd:complexType name="NC-Drill-Settings">
    <xsd:attribute name="Format" type ="xsd:string" use="required" />
    <xsd:attribute name="OmitZeroes" type="NC-Omit-Zeroes" default="None" />
  </xsd:complexType>
    
  <xsd:complexType name="ImportOptions">
    <xsd:all>
      <xsd:element name="PortNamingConvention" type="PortNamingConvention" minOccurs="0" maxOccurs="1" />
      <xsd:element name="Stitching" minOccurs="0" maxOccurs="1">
        <xsd:complexType>
          <xsd:attribute name="Tolerance" type="stackup:PosDbl" use="optional" />
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="NC-Drill-Settings" type="NC-Drill-Settings" minOccurs="0" maxOccurs="1"/>
    </xsd:all>
    
    <xsd:attribute name="UnitsOverride" type="stackup:LengthType" use="optional" />
    <xsd:attribute name="AutoClose" type="xsd:boolean" use="optional" default="false" />
    <xsd:attribute name="ConvertClosedWideLinesToPolys" type="xsd:boolean" use="optional" default="false" />
    <xsd:attribute name="RoundTo" type="PosInt" use="optional" />
    <xsd:attribute name="DefeatureTolerance" type="stackup:PosDbl" use="optional" />
    <xsd:attribute name="Flatten" type="xsd:boolean" use="optional" default="true" />
    <xsd:attribute name="EnableDefaultComponentValues" type="xsd:boolean" use="optional" default="true" />
    <xsd:attribute name="ImportDummyNet" type="xsd:boolean" use="optional" default="false"/>
    <xsd:attribute name="GDSIIConvertPolygonToCircles" type="xsd:boolean" use="optional" default="false" />
    <xsd:attribute name="ImportCrossHatchShapesAsLines" type="xsd:boolean" use ="optional" default ="true"/>
    <xsd:attribute name="MaxAntiPadRadius" type="stackup:PosDbl" use="optional" />
    <xsd:attribute name="AntiPadReplaceRadius" type="stackup:PosDbl" use="optional" />
    <xsd:attribute name="MinBondwireWidth" type="stackup:PosDbl" use="optional" />
  </xsd:complexType>

  <xsd:complexType name="Nets">
    <xsd:sequence>
      <xsd:element name="Net" type="Net" minOccurs="1" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>
    
  <xsd:complexType name="NetClass">
    <xsd:attribute name="Name" type="xsd:string" use="required" />
  </xsd:complexType>

  <xsd:complexType name="Net">
      <xsd:sequence>
          <xsd:element name="NetClass" type="NetClass" minOccurs="0" maxOccurs="unbounded" />
      </xsd:sequence>
      <xsd:attribute name="Name" type="xsd:string" use="required" />
      <xsd:attribute name="PinsBecomePorts" type="xsd:boolean" use="optional" default="false" />
      <xsd:attribute name="IsSignalNet" type="xsd:boolean" use="optional"/>
  </xsd:complexType>

    <xsd:simpleType name="GDSBool">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="false"/>
            <xsd:enumeration value="true"/>
            <xsd:enumeration value="0"/>
            <xsd:enumeration value="1"/>
            <xsd:enumeration value="no"/>
            <xsd:enumeration value="yes"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name ="GDS_CELL_RULES">
        <xsd:all>
            <xsd:element name ="BLACK_BOX_CELLS" type="xsd:string" minOccurs="0" maxOccurs="1"/>
            <xsd:element name ="WHITE_BOX_CELLS" type="xsd:string" minOccurs="0" maxOccurs="1"/>
            <xsd:element name ="GRAY_BOX_CELLS" type="xsd:string" minOccurs="0" maxOccurs="1"/>
        </xsd:all>
    </xsd:complexType>
        
  <xsd:complexType name ="GDS_NET_DEFINITIONS">
      <xsd:all>
          <xsd:element name ="USE_TEXT_FROM_HIERARCHY_LEVEL" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name ="USE_TEXT_FROM_CELLS" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name ="USE_TEXT_FROM_HIERARCHY_BLOCK" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name ="VDD_NETS" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name ="GND_NETS" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name ="SIGNAL_NETS" type="xsd:string" minOccurs="0" maxOccurs="1"/>
      </xsd:all>
      <xsd:attribute name="USE_TOP_LEVEL_TEXT_ONLY" type="GDSBool" use="optional" default="false"/>
      <xsd:attribute name="NET_NAME_CASE_SENSITIVE" type="GDSBool" use="optional" default="true"/>
  </xsd:complexType>


</xsd:schema>
