<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">

<!--
Copyright Contributors to the libdnf project.

This file is part of libdnf: https://github.com/rpm-software-management/libdnf/

Libdnf is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.

Libdnf is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with libdnf.  If not, see <https://www.gnu.org/licenses/>.
-->

<node>
<!-- org.rpm.dnf.v0.Goal:
   @short_description: Interface to Goal
-->
<interface name="org.rpm.dnf.v0.Goal">
    <!--
        resolve:
        @options: an array of key/value pairs to modify dependency resolving
        @transaction_items: array of (object_type, action, reason, {transaction_item_attributes}, {object}) tuples. object_type is one of libdnf5::transaction::TransactionItemType, action is one of libdnf5::transaction::TransactionItemAction, reason is one of libdnf5::transaction::TransactionItemReason enums. Each of these enums are represented as strings using corresponding libdnf5::transaction::\*_to_string() methods. transaction_item_attributes is a map {attribute: value}. Currently "reason_change_group_id" attribute is used for target group id in case the action is ReasonChange and the reason Group, and "replaces" containing a vector of packages ids being replaced by this item. Finally the object is a map {attribute: value} and represents (according to object_type) package, group, environment, or module. These package attributes are returned: "name", "epoch", "version", "release", "arch", "repo_id", "from_repo_id", "package_size", "install_size", "evr", and "reason". For groups the object contains "groupid" and "name" attributes.
        @result: problems detected during transaction resolving. Possible values are 0 - no problem, 1 - no problem, but some info / warnings are present or 2 - resolving failed.

        Resolve the transaction.

        Following @options are supported:
            - allow_erasing: boolean, default false
                Whether removal of installed package is allowed to resolve the transaction.

        Unknown options are ignored.
    -->
    <method name="resolve">
        <arg name="options" type="a{sv}" direction="in" />
        <arg name="transaction_items" type="a(sssa{sv}a{sv})" direction="out" />
        <arg name="result" type="u" direction="out" />
    </method>


    <!--
        get_transaction_problems_string:
        @problems: array of strings containing all problems found during the transaction resolution.

        Return all problems found during the transaction resolution as human readable messages.
    -->
    <method name="get_transaction_problems_string">
        <arg name="problems" type="as" direction="out" />
    </method>


    <!--
        get_transaction_problems:
        @problems: array of {key: value} maps

        Return all problems found during the transaction resolution as structures. This is the list of problem keys:
        always present:
        action - see include/libdnf5/base/goal_elements.hpp: GoalAction
        problem - see include/libdnf5/base/goal_elements.hpp: GoalProblem
        optional:
        goal_job_settings - {string: variant}, settings used to resolve the goal
        spec - string, usually nevra of affected package
        additional_data - array of strings, more details on the problem
        solver_problems - problems reported by underlying libsolv
    -->
    <method name="get_transaction_problems">
        <arg name="problems" type="aa{sv}" direction="out" />
    </method>


    <!--
        do_transaction:
        @options: an array of key/value pairs to modify transaction running

        Perform the resolved transaction.

        Following @options are supported:
            - comment: string
                Adds a comment to a transaction.
            - offline: boolean, default false
                If true, the transaction will be prepared to run during the next reboot. Otherwise, it will run immediately.
            - interactive: boolean, default true
                Set to "true", when the operation is done by a user, thus user interaction like password prompts can be done.
            - downloadonly: boolean, default false, since 5.2.16
                If true, only download the resolved package set without executing an RMP transaction. Along with the offline option, the offline transaction files are prepared, but the execution of the transaction is not initiated.

        Unknown options are ignored.
    -->
    <method name="do_transaction">
        <arg name="options" type="a{sv}" direction="in" />
    </method>

    <!--
        cancel:
        @success: true if the cancellation was successfully requested
        @error_msg: error message if the cancellation was refused

        Cancel the transaction that was initiated by `do_transaction()`. The transaction can only be canceled during the package download phase. Once the RPM transaction has begun, cancellation is no longer permitted.
    -->
    <method name="cancel">
        <arg name="success" type="b" direction="out" />
        <arg name="error_msg" type="s" direction="out" />
    </method>

    <!--
        reset:
        Reset the prepared rpm transaction. After this call the session is ready to perform another rpm transaction.
    -->
    <method name="reset">
    </method>

</interface>

</node>
