<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="0.1" elementFormDefault="unqualified">

  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <!-- DETECTOR SETUP RELATED TAGS  -->

  <!-- ~~~~~~~~~~~~~~~~~~~~~~ -->
  <!-- DIT/NDIT Types         -->
  <!-- ~~~~~~~~~~~~~~~~~~~~~~ -->
  <xs:simpleType name="DIT_Type">   
    <xs:annotation>
      <xs:appinfo>Set Exposure Time (DIT)</xs:appinfo>
      <xs:documentation xml:lang="en">
        DIT (in seconds) for all exposures: target and sky. 0: minimum value, 21600: maximum value.  
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:float">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="21600"/> <!-- Six hours in seconds. -->
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="NREADS_Type">      
    <xs:annotation>
      <xs:appinfo>Set Number of Reads</xs:appinfo>
      <xs:documentation xml:lang="en">
        Number of read frames per group in the ramp. Acceptable value must be positive integer.   
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:positiveInteger"/>
  </xs:simpleType>

  <xs:simpleType name="NDROPS_Type">      
    <xs:annotation>
      <xs:appinfo>Set Number of Drops</xs:appinfo>
      <xs:documentation xml:lang="en">
        Number of drop frames per group in the ramp. Acceptable value must be nonNegative integer.    
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:nonNegativeInteger"/>
  </xs:simpleType>

  <xs:simpleType name="NGROUPS_Type">      
    <xs:annotation>
      <xs:appinfo>Set Number of Groups</xs:appinfo>
      <xs:documentation xml:lang="en">
        Number of groups per ramp (number of read frames + number of drop frames). Acceptable value must be positive integer.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:positiveInteger"/>
  </xs:simpleType>

  <xs:simpleType name="NCOADDS_Type">      
    <xs:annotation>
      <xs:appinfo>Set Number of Coadditions</xs:appinfo>
      <xs:documentation xml:lang="en">
        Number of read frames to sum together. Acceptable value must be positive integer.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:positiveInteger"/>
  </xs:simpleType>

  <xs:simpleType name="NDIT_Type">      
    <xs:annotation>
      <xs:appinfo>Set Number of DITs</xs:appinfo>
      <xs:documentation xml:lang="en">
        Number of science target frames (NDITs). Acceptable value must be positive integer.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:positiveInteger"/>
  </xs:simpleType>
   
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <!-- READOUT Type              -->
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <xs:simpleType name="READOUT_Type">  
    <xs:annotation>
      <xs:appinfo>Set Read-Out Mode</xs:appinfo>
      <xs:documentation xml:lang="en">
        Detector readout mode for the image.   
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="Full_Image"/>
      <xs:enumeration value="Center"/>
      <xs:enumeration value="Bottom"/>
      <xs:enumeration value="Top"/>
      <xs:enumeration value="256x256"/>
      <xs:enumeration value="128x128"/>
      <xs:enumeration value="64x64"/>
      <xs:enumeration value="32x32"/>
      <xs:enumeration value="1000x1000"/>
      <xs:enumeration value="coro_stripe"/>
      <xs:enumeration value="PD_wollaston_stripe_small"/>
      <xs:enumeration value="PD_wollaston_stripe_large"/>
      <xs:enumeration value="run2"/>
      <!-- <xs:enumeration value="fake_readout_1"/> -->
      <xs:enumeration value="obs_stripe_200px"/>
      <xs:enumeration value="obs_stripe_512px"/>
    </xs:restriction>
  </xs:simpleType>
   
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <!-- NEXP Type                 -->
  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
  <xs:simpleType name="NEXP_Type">
    <xs:annotation>
      <xs:appinfo>Number of Exposures</xs:appinfo>
      <xs:documentation xml:lang="en">
        Determines the number of exposures. 1: minimum value. 
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:positiveInteger">
      <xs:minInclusive value="1"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="XMIN_Type">         
    <xs:annotation>
      <xs:appinfo>Minimum of X-axis</xs:appinfo>
      <xs:documentation xml:lang="en">
        Minimum value in X-direction. 0: minimum value, 1200: maximum value. 
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:nonNegativeInteger">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="1200"/>
    </xs:restriction>
  </xs:simpleType>
    
  <xs:simpleType name="XMAX_Type"> 
    <xs:annotation>
      <xs:appinfo>Maximum of X-axis</xs:appinfo>
      <xs:documentation xml:lang="en">
        Maximum value in X-direction. 0: minimum value, 1200: maximum value. 
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:nonNegativeInteger">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="1200"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="YMIN_Type">
    <xs:annotation>
      <xs:appinfo>Minimum of Y-axis</xs:appinfo>
      <xs:documentation xml:lang="en">
        Minimum value in Y-direction. 0: minimum value, 1200: maximum value. 
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:nonNegativeInteger">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="1200"/>
    </xs:restriction>
  </xs:simpleType>
 
  <xs:simpleType name="YMAX_Type">  
    <xs:annotation>
      <xs:appinfo>Maximum of Y-axis</xs:appinfo>
      <xs:documentation xml:lang="en">
        Maximum value in  Y-direction. 0: minimum value, 1200: maximum value. 
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:nonNegativeInteger">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="1200"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="NEXTASBG_Type">  
    <xs:annotation>
      <xs:appinfo>Next as BG</xs:appinfo>
      <xs:documentation xml:lang="en">
        1: next image will be used as background, 0: next image will not be used as background.  
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:boolean">
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="PREVASBG_Type">
    <xs:annotation>
      <xs:appinfo>Previous as BG</xs:appinfo>
      <xs:documentation xml:lang="en">
        1: previous image will be used as background, 0: previous image will not be used as background.  
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:boolean">
    </xs:restriction>
  </xs:simpleType>
 
  <xs:simpleType name="SAVE_Type">  
    <xs:annotation>
      <xs:appinfo>Data Frames</xs:appinfo>
      <xs:documentation xml:lang="en">
        1: image file will be saved, 0: image file will not be saved.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:boolean">
    </xs:restriction>
  </xs:simpleType>
 
  <!-- ~~~~~~~~~~~~~~~~~~~~~~ -->
  <!-- Detector Setup         -->
  <!-- ~~~~~~~~~~~~~~~~~~~~~~ -->
  <xs:complexType name="DetectorSetup_Type" mixed="false">
    <xs:all>
      <xs:element name="DIT"      type="DIT_Type"      minOccurs="0" maxOccurs="1"/>
      <xs:element name="NREADS"   type="NREADS_Type"   minOccurs="0" maxOccurs="1"/>
      <xs:element name="NDROPS"   type="NDROPS_Type"   minOccurs="0" maxOccurs="1"/>
      <xs:element name="NGROUPS"  type="NGROUPS_Type"  minOccurs="0" maxOccurs="1"/>
      <xs:element name="NCOADDS"  type="NCOADDS_Type"  minOccurs="0" maxOccurs="1"/>
      <xs:element name="NDIT"     type="NDIT_Type"     minOccurs="0" maxOccurs="1"/>
      <xs:element name="READOUT"  type="READOUT_Type"  minOccurs="0" maxOccurs="1"/>
      <xs:element name="XMIN"     type="XMIN_Type"     minOccurs="0" maxOccurs="1"/>
      <xs:element name="XMAX"     type="XMAX_Type"     minOccurs="0" maxOccurs="1"/>
      <xs:element name="YMIN"     type="YMIN_Type"     minOccurs="0" maxOccurs="1"/>
      <xs:element name="YMAX"     type="YMAX_Type"     minOccurs="0" maxOccurs="1"/>
      <xs:element name="NEXTASBG" type="NEXTASBG_Type" minOccurs="0" maxOccurs="1"/>
      <xs:element name="PREVASBG" type="PREVASBG_Type" minOccurs="0" maxOccurs="1"/>
      <xs:element name="SAVE"     type="SAVE_Type"     minOccurs="0" maxOccurs="1"/>
    </xs:all>
  </xs:complexType>
</xs:schema>
