<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (C) 2010-2023 Evolveum and contributors
  ~
  ~ Licensed under the EUPL-1.2 or later.
  -->

<report xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
        xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
        xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
        xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
        oid="00000000-0000-0000-0000-286d76cea7c5">
    <name>Simulation report: Objects</name>
    <description>Objects processed by a given simulation.</description>
    <assignment id="1">
        <identifier>archetype</identifier>
        <targetRef oid="00000000-0000-0000-0000-000000000171" type="ArchetypeType"/>
    </assignment>
    <objectCollection>
        <collection>
            <!-- Type is declared in the view element. -->
            <filter>
                <q:text>. ownedByOid `simulationResultRef?.oid`</q:text>
            </filter>
        </collection>
        <view>
            <column id="2">
                <name>id</name>
                <display>
                    <label>
                        <t:orig>ID</t:orig>
                        <t:translation>
                            <t:key>SimulationReports.column.ID</t:key>
                        </t:translation>
                    </label>
                </display>
                <export>
                    <expression>
                        <script>
                            <code>object.id</code>
                        </script>
                    </expression>
                </export>
            </column>
            <column id="3">
                <name>oid</name>
                <path>oid</path>
                <display>
                    <label>
                        <t:orig>OID</t:orig>
                        <t:translation>
                            <t:key>SimulationReports.column.OID</t:key>
                        </t:translation>
                    </label>
                </display>
                <previousColumn>id</previousColumn>
            </column>
            <column id="4">
                <name>name</name>
                <path>name</path>
                <previousColumn>oid</previousColumn>
            </column>
            <column id="5">
                <name>type</name>
                <path>type</path>
                <previousColumn>name</previousColumn>
            </column>
            <column id="6">
                <name>archetype</name>
                <path>structuralArchetypeRef</path>
                <previousColumn>type</previousColumn>
            </column>
            <column id="7">
                <name>resourceRef</name>
                <path>resourceObjectCoordinates/resourceRef</path>
                <previousColumn>archetype</previousColumn>
            </column>
            <column id="8">
                <name>kind</name>
                <path>resourceObjectCoordinates/kind</path>
                <previousColumn>resourceRef</previousColumn>
            </column>
            <column id="9">
                <name>intent</name>
                <path>resourceObjectCoordinates/intent</path>
                <previousColumn>kind</previousColumn>
            </column>
            <column id="10">
                <name>tag</name>
                <path>resourceObjectCoordinates/tag</path>
                <previousColumn>intent</previousColumn>
            </column>
            <column id="11">
                <name>objectMark</name>
                <display>
                    <label>
                        <t:orig>Object mark</t:orig>
                        <t:translation>
                            <t:key>SimulationReports.column.objectMark</t:key>
                        </t:translation>
                    </label>
                </display>
                <previousColumn>tag</previousColumn>
                <export>
                    <expression>
                        <script>
                            <code>objectMarks</code>
                        </script>
                    </expression>
                </export>
            </column>
            <column id="12">
                <name>state</name>
                <path>state</path>
                <previousColumn>objectMark</previousColumn>
            </column>
            <column id="13">
                <name>resultStatus</name>
                <path>resultStatus</path>
                <previousColumn>state</previousColumn>
            </column>
            <column id="14">
                <name>eventMarkRef</name>
                <path>eventMarkRef</path>
                <previousColumn>resultStatus</previousColumn>
            </column>
            <column id="15">
                <name>message</name>
                <display>
                    <label>
                        <t:orig>Message</t:orig>
                        <t:translation>
                            <t:key>SimulationReports.column.message</t:key>
                        </t:translation>
                    </label>
                </display>
                <previousColumn>eventMarkRef</previousColumn>
                <export>
                    <expression>
                        <script>
                            <code>object?.result?.message</code>
                        </script>
                    </expression>
                </export>
            </column>
            <type>c:SimulationResultProcessedObjectType</type>
        </view>
        <parameter id="16">
            <name>simulationResultRef</name>
            <type>c:ObjectReferenceType</type>
            <targetType>SimulationResultType</targetType>
            <display>
                <label>
                    <t:orig>simulationResultRef</t:orig>
                    <t:translation>
                        <t:key>runReportPopupContent.param.name.simulationResultRef</t:key>
                    </t:translation>
                </label>
            </display>
        </parameter>
        <subreport id="17">
            <name>objectMarks</name>
            <type>c:ObjectReferenceType</type>
            <expression>
                <script>
                    <code>
                        import com.evolveum.midpoint.xml.ns._public.common.common_3.SimulationResultProcessedObjectType

                        report.getObjectMarks(object as SimulationResultProcessedObjectType)
                    </code>
                </script>
            </expression>
        </subreport>
    </objectCollection>
</report>
