<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2010-2024 Evolveum and contributors
  ~
 ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<archetype xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
           xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
           xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
           xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oid="8053bbaa-6578-442d-a7a6-9c5b39b8a389" version="5">
    <name>AD - ad-group</name>
    <assignment id="1">
        <assignmentRelation id="5">
            <holderType>c:RoleType</holderType>
        </assignmentRelation>
    </assignment>
    <inducement id="6">
        <construction>
            <resourceRef oid="052a29b1-cde5-4546-9787-916e4a846f2e" relation="org:default" type="c:ResourceType"/>
            <kind>entitlement</kind>
            <intent>ad-group</intent>
        </construction>
        <focusType>c:RoleType</focusType>
    </inducement>
    <inducement id="7">
        <construction>
            <resourceRef oid="052a29b1-cde5-4546-9787-916e4a846f2e" relation="org:default" type="c:ResourceType"/>
            <kind>account</kind>
            <intent>default</intent>
        </construction>
        <order>2</order>
        <focusType>UserType</focusType>
    </inducement>
    <inducement id="9">
        <identifier>generate-role-properties-from-identifier</identifier>
        <focusMappings>
            <mapping id="10">
                <name>generate-name-from-identifier</name>
                <strength>weak</strength>
                <source>
                    <path>identifier</path>
                </source>
                <expression>
                    <script>
                        <code>"ad:" + identifier</code>
                    </script>
                </expression>
                <target>
                    <path>name</path>
                </target>
            </mapping>
            <mapping id="12">
                <name>generate-displayName-from-identifier</name>
                <strength>strong</strength>
                <source>
                    <path>identifier</path>
                </source>
                <expression>
                    <script>
                        <code>"AD: " + identifier?.replace('-', ' ')?.capitalize()</code>
                    </script>
                </expression>
                <target>
                    <path>displayName</path>
                </target>
            </mapping>
        </focusMappings>
        <focusType>c:RoleType</focusType>
    </inducement>
    <archetypePolicy>
        <display>
            <label>AD Group Role</label>
            <pluralLabel>AD Group Roles</pluralLabel>
            <tooltip>AD Group Role</tooltip>
            <icon>
                <cssClass>fe fe-role</cssClass>
                <color>olive</color>
            </icon>
        </display>
    </archetypePolicy>
</archetype>
