<!--
  ~ Copyright (c) 2020 Evolveum and contributors
  ~
  ~ Licensed under the EUPL-1.2 or later.
  -->

<archetype oid="00000000-0000-0000-0000-000000000509"
        xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
        xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
        xmlns:mext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3"
        xmlns:scext="http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3">
    <name>Iterative action task</name>
    <archetypePolicy>
        <display>
            <label>
                <orig>Iterative action task</orig>
                <translation>
                    <key>IterativeActionTask.title</key>
                </translation>
            </label>
            <pluralLabel>
                <orig>Iterative action tasks</orig>
                <translation>
                    <key>IterativeActionTasks.title</key>
                </translation>
            </pluralLabel>
            <icon>
                <cssClass>fa fa-bullseye</cssClass>
                <color>green</color>
            </icon>
        </display>
        <itemConstraint id="1">
            <path>extension</path>
            <visibility>vacant</visibility>
        </itemConstraint>
        <itemConstraint id="2">
            <path>extension/mext:objectType</path>
            <visibility>visible</visibility>
        </itemConstraint>
        <itemConstraint id="3">
            <path>extension/mext:objectQuery</path>
            <visibility>visible</visibility>
        </itemConstraint>
        <itemConstraint id="4">
            <path>extension/mext:searchOptions</path>
            <visibility>visible</visibility>
        </itemConstraint>
        <itemConstraint id="5">
            <path>extension/mext:useRepositoryDirectly</path>
            <visibility>visible</visibility>
        </itemConstraint>
        <itemConstraint id="6">
            <path>extension/scext:executeScript</path>
            <visibility>visible</visibility>
        </itemConstraint>
        <itemConstraint id="7">
            <path>extension/mext:workerThreads</path>
            <visibility>visible</visibility>
        </itemConstraint>
        <adminGuiConfiguration>
            <objectDetails>
                <type>c:TaskType</type>
                <panel id="8">
                    <identifier>activity</identifier>
                    <panel id="10">
                        <identifier>work</identifier>
                        <container id="11">
                            <identifier>work-iterative-scripting</identifier>
                            <path>activity/work/iterativeScripting</path>
                        </container>
                    </panel>
                </panel>
                <panel id="9">
                    <identifier>taskBasic</identifier>
                    <container id="12">
                        <identifier>objects-to-process</identifier>
                        <display>
                            <label>
                                <orig>Objects to process</orig>
                                <translation>
                                    <key>IterativeActionTask.objectsToProcess</key>
                                </translation>
                            </label>
                        </display>
                        <item id="14">
                            <c:path>extension/mext:objectType</c:path>
                        </item>
                        <item id="15">
                            <c:path>extension/mext:objectQuery</c:path>
                        </item>
                        <item id="16">
                            <c:path>extension/mext:searchOptions</c:path>
                        </item>
                        <item id="17">
                            <c:path>extension/mext:useRepositoryDirectly</c:path>
                        </item>
                    </container>
                    <container id="13">
                        <identifier>bulk-action</identifier>
                        <display>
                            <label>
                                <orig>Action</orig>
                                <translation>
                                    <key>IterativeActionTask.action</key>
                                </translation>
                            </label>
                        </display>
                        <item id="18">
                            <c:path>extension/scext:executeScript</c:path>
                        </item>
                        <item id="19">
                            <c:path>extension/mext:workerThreads</c:path>
                        </item>
                    </container>
                </panel>
            </objectDetails>
        </adminGuiConfiguration>
    </archetypePolicy>
    <assignment id="20">
        <identifier>holderType</identifier>
        <assignmentRelation id="21">
            <holderType>TaskType</holderType>
        </assignmentRelation>
    </assignment>
    <inducement id="22">
        <identifier>nameMapping</identifier>
        <focusMappings>
            <mapping id="23">
                <strength>weak</strength>
                <expression>
                    <script>
                        <code>
                            return source.name
                        </code>
                    </script>
                </expression>
                <target>
                    <path>name</path>
                </target>
            </mapping>
        </focusMappings>
    </inducement>
</archetype>
