<?xml version="1.0" encoding="utf-8"?>
<!--
  DESCRIPTION: XML Schema Definition (XSD) for BIOSEAL VDS manifest extensions.
  This file defines the structure and constraints for BIOSEAL VDS (Visible Digital Seal) manifest extensions.
  It is used to extend the standard ISO 22376 VDS schema with additional elements and attributes.
  LAST UPDATED: 2025/02/11
-->
<xs:schema elementFormDefault="qualified" targetNamespace="https://trust.bioseal.codes"
	xmlns="https://trust.bioseal.codes"
	xmlns:otentik="https://trust.otentik.codes"
	xmlns:vds="https://trust.vdsic.org"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">

	<xs:import namespace="https://trust.vdsic.org" schemaLocation="https://trust.vdsic.org/schemas/01/vds.xsd"/>

  <!-- Biometric extension -->
  <xs:complexType name="BiometricExtensionType">
    <xs:complexContent>
      <xs:extension base="vds:FieldExtensionType">
        <xs:sequence>
          <xs:element name="Type" type="BiometricType"/>
          <xs:element name="Format" type="BiometricDataFormatType"/>
          <xs:element name="MinMinutiaCount" type="xs:integer" minOccurs="0"/>
          <xs:element name="MaxMinutiaCount" type="xs:integer" minOccurs="0"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:simpleType name="BiometricType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="BODY_ODOR"/>
      <xs:enumeration value="DNA"/>
      <xs:enumeration value="EAR_SHAPE"/>
      <xs:enumeration value="FACIAL_FEATURES"/>
      <xs:enumeration value="FINGERPRINT"/>
      <xs:enumeration value="FINGER_GEOMETRY"/>
      <xs:enumeration value="FOOT_PRINT"/>
      <xs:enumeration value="GAIT"/>
      <xs:enumeration value="HAND_GEOMETRY"/>
      <xs:enumeration value="IRIS"/>
      <xs:enumeration value="KEYSTROKE_DYNAMICS"/>
      <xs:enumeration value="LIP_MOVEMENT"/>
      <xs:enumeration value="PALM_PRINT"/>
      <xs:enumeration value="RETINA"/>
      <xs:enumeration value="SIGNATURE_DYNAMICS"/>
      <xs:enumeration value="THERMAL_FACE_IMAGE"/>
      <xs:enumeration value="THERMAL_HAND_IMAGE"/>
      <xs:enumeration value="VEIN_PATTERN"/>
      <xs:enumeration value="VOICE"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="BiometricDataFormatType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="UNDEFINED"/>
      <xs:enumeration value="FaceImageWebP"/>
      <xs:enumeration value="ID3_FACIAL_FEATURES_8A"/>
      <xs:enumeration value="ID3_FACIAL_FEATURES_8B"/>
      <xs:enumeration value="ID3_FACIAL_FEATURES_9A"/>
      <xs:enumeration value="ID3_FACIAL_FEATURES_9B"/>
      <xs:enumeration value="ID3_FACIAL_FEATURES_P1A"/>
      <xs:enumeration value="ID3_FACIAL_FEATURES_P2A"/>
      <xs:enumeration value="ID3_FACIAL_FEATURES_P2B"/>
      <xs:enumeration value="ISO_FINGER_MINUTIA_RECORD"/>
      <xs:enumeration value="ISO_FINGER_MINUTIA_COMPACT"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- DateFormat extension -->
  <xs:complexType name="DateFormatExtensionType">
    <xs:complexContent>
      <xs:extension base="vds:FieldExtensionType">
        <xs:sequence>
          <xs:element type="vds:ValueType" name="Value" maxOccurs="unbounded" minOccurs="1">
            <xs:annotation>
              <xs:documentation>
                The format of the date string.
              </xs:documentation>
            </xs:annotation>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <!--User authentication extension-->
  <xs:complexType name="UserAuthenticationExtensionType">
    <xs:complexContent>
      <xs:extension base="vds:ExtensionType">
        <xs:sequence>
          <xs:element name="AuthenticationMethod" type="AuthenticationMethodType" minOccurs="1" maxOccurs="1"/>
          <xs:element name="PasswordAuthentication" type="PasswordAuthenticationType" minOccurs="0" maxOccurs="1"/>
          <xs:element name="BiometricVerification" type="BiometricVerificationType" minOccurs="0" maxOccurs="1"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="AuthenticationMethodType">
    <xs:sequence>
      <xs:element name="Value">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="PASSWORD"/>
            <xs:enumeration value="BIOMETRICS"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="PasswordAuthenticationType">
    <xs:sequence>
      <xs:element name="FieldName" type="xs:string"/>
      <xs:element name="HashAlgorithm">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="SHA256"/>
            <xs:enumeration value="SHA384"/>
            <xs:enumeration value="SHA512"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="BiometricVerificationType">
    <xs:annotation>
      <xs:documentation>
        Defines the rules that must be followed to confirm the identity of a person through biometric verification.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element type="BiometricVerificationRuleType" name="BiometricVerificationRule" minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute type="xs:boolean" name="verifyAll" use="optional"/>
  </xs:complexType>

  <xs:complexType name="BiometricVerificationRuleType">
    <xs:annotation>
      <xs:documentation>Specifies a biometric verification rule.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="BiometricType" type="BiometricType"/>
      <xs:element name="Count" type="xs:int"/>
      <xs:element name="Threshold" type="xs:int"/>
    </xs:sequence>
  </xs:complexType>

  <!-- Portrait extension -->
  <xs:complexType name="PortraitExtensionType">
    <xs:complexContent>
      <xs:extension base="vds:FieldExtensionType">
        <xs:sequence>
          <xs:element name="Format" type="vds:ImageFormatType">
            <xs:annotation>
              <xs:documentation>
                The format of the image.
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="Height" type="xs:integer">
            <xs:annotation>
              <xs:documentation>
                The height of the image.
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="Width" type="xs:integer">
            <xs:annotation>
              <xs:documentation>
              The width of the image.
              </xs:documentation>
            </xs:annotation>
          </xs:element>
          <xs:element name="IodRatio">
            <xs:annotation>
              <xs:documentation>
                The Interocular Distance (IOD) ratio. This value represents the ratio of the distance between the eyes to the width of the image.
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:decimal">
                <xs:minExclusive value="0.0" />
                <xs:maxExclusive value="1.0" />
              </xs:restriction>
            </xs:simpleType>
          </xs:element>
          <xs:element name="EyePositionRatio">
            <xs:annotation>
              <xs:documentation>
                The Eye Position Ratio. This value represents the ratio of the distance from the top of the image to the eyes to the height of the image.
              </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
              <xs:restriction base="xs:decimal">
                <xs:minExclusive value="0.0" />
                <xs:maxExclusive value="1.0" />
              </xs:restriction>
            </xs:simpleType>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

</xs:schema>