<?xml version="1.0" ?>

<!--

 This file is part of the Sylius package.

 (c) Sylius Sp. z o.o.

 For the full copyright and license information, please view the LICENSE
 file that was distributed with this source code.

-->

<resources xmlns="https://api-platform.com/schema/metadata"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
    <resource class="Sylius\Bundle\CoreBundle\Message\Admin\Account\ResetPassword" shortName="Administrator">
        <attribute name="validation_groups">sylius</attribute>
        <attribute name="messenger">input</attribute>

        <collectionOperations>
            <collectionOperation name="admin_create_reset_password_request">
                <attribute name="method">POST</attribute>
                <attribute name="path">/admin/administrators/reset-password</attribute>
                <attribute name="input">Sylius\Bundle\CoreBundle\Message\Admin\Account\RequestResetPasswordEmail</attribute>
                <attribute name="output">false</attribute>
                <attribute name="status">202</attribute>
                <attribute name="denormalization_context">
                    <attribute name="groups">
                        <attribute>admin:reset_password:create</attribute>
                        <attribute>sylius:admin:reset_password:create</attribute>
                    </attribute>
                </attribute>
                <attribute name="openapi_context">
                    <attribute name="summary">Requests administrator's password reset.</attribute>
                </attribute>
            </collectionOperation>
        </collectionOperations>

        <itemOperations>
            <itemOperation name="admin_update_reset_password_request">
                <attribute name="method">PATCH</attribute>
                <attribute name="path">/admin/administrators/reset-password/{token}</attribute>
                <attribute name="input">Sylius\Bundle\CoreBundle\Message\Admin\Account\ResetPassword</attribute>
                <attribute name="output">false</attribute>
                <attribute name="status">202</attribute>
                <attribute name="denormalization_context">
                    <attribute name="groups">
                        <attribute>admin:reset_password:update</attribute>
                        <attribute>sylius:admin:reset_password:update</attribute>
                    </attribute>
                </attribute>
                <attribute name="openapi_context">
                    <attribute name="summary">Resets administrator's password.</attribute>
                </attribute>
            </itemOperation>
        </itemOperations>

        <property name="token" identifier="true" />
        <property name="newPassword" required="true" />
        <property name="confirmNewPassword" required="true" />
    </resource>
</resources>
