<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
  ~ Copyright (c) 2010-2017 Evolveum and contributors
  ~
  ~ Licensed under the EUPL-1.2 or later.
  --><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://prism.evolveum.com/xml/ns/public/annotation-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" xmlns:s="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3" xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:tns="http://midpoint.evolveum.com/xml/ns/public/common/api-types-3" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" elementFormDefault="qualified" jaxb:extensionBindingPrefixes="xjc" jaxb:version="3.0" targetNamespace="http://midpoint.evolveum.com/xml/ns/public/common/api-types-3">

    <xsd:annotation>
        <xsd:documentation>
            Schema that defines data types used in XML version of midPoint APIs.

            Version: 3.7
            Recommended namespace prefix: apit
        </xsd:documentation>
    </xsd:annotation>

    <xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/common/common-3" schemaLocation="common-3.xsd">
        <xsd:annotation>
            <xsd:documentation>
                Common midPoint schema.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:import>

    <xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3" schemaLocation="../model/scripting/scripting-3.xsd">
        <xsd:annotation>
            <xsd:documentation>
                Scripting language.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:import>

    <xsd:import namespace="http://prism.evolveum.com/xml/ns/public/annotation-3" schemaLocation="../annotation-3.xsd">
        <xsd:annotation>
            <xsd:documentation>
                Common midPoint annotations used in various XSD schemas.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:import>

    <xsd:import namespace="http://prism.evolveum.com/xml/ns/public/types-3" schemaLocation="../types-3.xsd">
        <xsd:annotation>
            <xsd:documentation>
                Prism data types.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:import>

    <xsd:complexType name="ObjectModificationType">
        <xsd:annotation>
            <xsd:documentation>
                Describes a change of attributes of a specific object.
                All changes are expected to happen atomically, but
                there may be exceptions. Please check with the
                documentation of the interface using this type for
                more details.

                   Used in the interfaces (modifyObject)
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="oid" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation>
                        OID of the object to modify.

                        Due to consistency reasons this should rather be
                        an attribute. But it is an element because of
                        OpenESB bug with attributes in message parts.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element maxOccurs="unbounded" minOccurs="1" name="itemDelta" type="t:ItemDeltaType">
                <xsd:annotation>
                    <xsd:documentation>
                        Describe a change to a single attribute of an object.

                        TODO: this should be renamed to "itemModification"
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="objectModification" type="tns:ObjectModificationType"/>


    <xsd:complexType name="ObjectListType">
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="object" type="c:ObjectType"/>
        </xsd:sequence>
        <xsd:attribute name="count" type="xsd:int"/>
    </xsd:complexType>
    <xsd:element name="objectList" type="tns:ObjectListType"/>

    <xsd:complexType name="ResourceObjectShadowListType">
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="object" type="c:ShadowType"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="UserListType">
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="user" type="c:UserType"/>
        </xsd:sequence>
    </xsd:complexType>

        <xsd:complexType name="ResourceObjectType">
        <xsd:annotation>
            <xsd:appinfo>
                <a:container/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:any maxOccurs="unbounded" minOccurs="1" namespace="##other" processContents="lax">
                <xsd:annotation>
                    <xsd:appinfo>
                        <xjc:dom/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:any>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="ResourceObjectIdentificationType">
        <xsd:annotation>
            <xsd:appinfo>
                <a:container/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:any maxOccurs="unbounded" minOccurs="1" namespace="##other" processContents="lax">
                <xsd:annotation>
                    <xsd:appinfo>
                        <xjc:dom/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:any>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:long" use="optional"/>
    </xsd:complexType>

    <xsd:complexType name="PropertyReferenceListType">
        <xsd:annotation>
            <xsd:documentation>
                DEPRECATED
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="property" type="t:ItemPathType"/>
        </xsd:sequence>
    </xsd:complexType>

    <!-- the following types are related to script execution; these are experimental for now -->
    <xsd:complexType name="XmlScriptsType">
        <xsd:sequence>
            <xsd:any maxOccurs="unbounded" minOccurs="0"/>         <!-- objects substitutable with s:expression should be put here -->
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ExecuteScriptResponseType">
        <xsd:annotation>
            <xsd:documentation>
                Result of a single script execution.
            </xsd:documentation>
            <xsd:appinfo>
                <a:since>3.6</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="output" type="s:ExecuteScriptOutputType">
                <xsd:annotation>
                    <xsd:documentation>
                        Data and console output of the execution of the script.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="result" type="c:OperationResultType">
                <xsd:annotation>
                    <xsd:documentation>
                        Operation result covering the execution of the script.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="executeScriptResponse" type="tns:ExecuteScriptResponseType"/>

    <xsd:complexType name="ScriptOutputsType">
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="output" type="tns:SingleScriptOutputType"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="SingleScriptOutputType">
        <xsd:sequence>
            <xsd:choice>
                <xsd:element name="dataOutput" type="s:PipelineDataType"/>
                <xsd:element name="mslData" type="xsd:string"/>
            </xsd:choice>
            <xsd:element minOccurs="0" name="textOutput" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ExecuteScriptsOptionsType">
        <xsd:sequence>
            <xsd:element minOccurs="0" name="outputFormat" type="tns:OutputFormatType"/>
            <xsd:element minOccurs="0" name="objectLimit" type="xsd:int"/>
            <xsd:element minOccurs="0" name="executeAsynchronously" type="xsd:boolean"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="OutputFormatType">
        <xsd:annotation>
            <xsd:documentation>
                TODO
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="xml">
                <xsd:annotation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="XML"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
            <xsd:enumeration value="msl">
                <xsd:annotation>
                    <xsd:appinfo>
                        <jaxb:typesafeEnumMember name="MSL"/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="ObjectDeltaListType">
        <xsd:annotation>
            <xsd:documentation>
                List of object deltas.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="delta" type="t:ObjectDeltaType"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ObjectDeltaOperationListType">
        <xsd:annotation>
            <xsd:documentation>
                List of object delta operations (deltas + operation results).
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="deltaOperation" type="c:ObjectDeltaOperationType"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="CompareResultType">
        <xsd:annotation>
            <xsd:documentation>
                EXPERIMENTAL. TODO.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="currentToProvided" type="t:ObjectDeltaType">
                <xsd:annotation>
                    <xsd:documentation>
                        Delta that would change the current object (in midPoint) into the client-provided one.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="providedToCurrent" type="t:ObjectDeltaType">
                <xsd:annotation>
                    <xsd:documentation>
                        Delta that would change the client-provided object to the current object (in midPoint).
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="normalizedObject" type="c:ObjectType">
                <xsd:annotation>
                    <xsd:documentation>
                        "Normalized version" of provided object (i.e. the one that is created by parsing and re-serializing the object.)
                        Items to be ignored are left out from it.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element minOccurs="0" name="currentObject" type="c:ObjectType">
                <xsd:annotation>
                    <xsd:documentation>
                        Current version of object, as stored in midPoint.
                        Items to be ignored are left out from it.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="PolicyItemsDefinitionType">
        <xsd:annotation>
            <xsd:documentation>
                Defined items and rules for generating/validating values
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" name="policyItemDefinition" type="tns:PolicyItemDefinitionType">
                <xsd:annotation>
                    <xsd:documentation>
                        Definition for the item to be generated/validated
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="policyItemsDefinition" type="tns:PolicyItemsDefinitionType"/>

    <xsd:complexType name="PolicyItemDefinitionType">
        <xsd:annotation>
            <xsd:documentation>

            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="1" name="target" type="tns:PolicyItemTargetType">
                <xsd:annotation>
                    <xsd:documentation>
                        Definition of item for which the value will be generated/validated
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>

            <xsd:element minOccurs="0" name="valuePolicyRef" type="c:ObjectReferenceType">
                <xsd:annotation>
                    <xsd:documentation>
                        Reference to the value policy that should be used to generate/validate the value.
                        If not specified, system defined policy is used
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:objectReferenceTargetType>c:ValuePolicyType</a:objectReferenceTargetType>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>

            <xsd:element minOccurs="0" name="value" type="xsd:anyType">
                <xsd:annotation>
                    <xsd:documentation>
                        Contains either generated value or value which will be validated
                    </xsd:documentation>
                    <xsd:appinfo>
                        <a:rawType/>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>

            <xsd:element minOccurs="0" name="execute" type="xsd:boolean">
                <xsd:annotation>
                    <xsd:documentation>
                        Specifies if the generated value should be set immediately to the object.
                        Relevant only for generate operation.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>

            <xsd:element minOccurs="0" name="result" type="c:OperationResultType">
                <xsd:annotation>
                    <xsd:documentation>
                        Specifies if the generated value should be set immediately to the object.
                        Relevant only for generate operation.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>

        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="policyItemDefinition" type="tns:PolicyItemDefinitionType"/>

   <xsd:complexType name="PolicyItemTargetType">
        <xsd:annotation>
            <xsd:documentation>
                Defined items and rules for generating/validating values
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="1" name="path" type="t:ItemPathType">
                <xsd:annotation>
                    <xsd:documentation>
                        Definition for the item to be generated/validated
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="policyItemTarget" type="tns:PolicyItemTargetType"/>


    <xsd:complexType name="ExecuteCredentialResetRequestType">
        <xsd:annotation>
            <xsd:documentation>
            </xsd:documentation>
            <xsd:appinfo>
                <a:container/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="resetMethod" type="xsd:string">
            </xsd:element>
            <xsd:element minOccurs="0" name="userEntry" type="xsd:string">
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="executeCredentialResetRequest" type="tns:ExecuteCredentialResetRequestType"/>

    <xsd:complexType name="ExecuteCredentialResetResponseType">
        <xsd:annotation>
            <xsd:documentation>
            </xsd:documentation>
            <xsd:appinfo>
                <a:container/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="message" type="c:LocalizableMessageType">
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="executeCredentialResetResponse" type="tns:ExecuteCredentialResetResponseType"/>


    <xsd:complexType name="TerminateSessionEventType">
        <xsd:annotation>
            <xsd:documentation>
                Describe terminate session event cluster-wide. Strongly experimental.
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimental>true</a:experimental>
                <a:since>4.0</a:since>
                <a:container/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="principal" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="terminateSessionEvent" type="tns:TerminateSessionEventType"/>

    <xsd:complexType name="UserSessionManagementListType">
        <xsd:annotation>
            <xsd:documentation>
                Describe list of sessions.

                Be aware: EXPERIMENTAL
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimental>true</a:experimental>
                <a:since>4.0</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="session" type="tns:UserSessionManagementType"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="sessionManagement" type="tns:UserSessionManagementListType"/>

    <xsd:complexType name="UserSessionManagementType">
        <xsd:annotation>
            <xsd:documentation>
                Describe session - user, active sessions, nodes where the user is active

                Be aware: EXPERIMENTAL
            </xsd:documentation>
            <xsd:appinfo>
                <a:experimental>true</a:experimental>
                <a:since>4.0</a:since>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element maxOccurs="1" minOccurs="0" name="focus" type="c:FocusType"/>
            <xsd:element maxOccurs="1" minOccurs="0" name="activeSessions" type="xsd:int"/>
            <xsd:element maxOccurs="unbounded" minOccurs="0" name="node" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="userSessionManagement" type="tns:UserSessionManagementType"/>

</xsd:schema>