<?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\ApiBundle\Command\Account\VerifyCustomerAccount" shortName="Customer">
        <attribute name="route_prefix">shop</attribute>
        <attribute name="messenger">input</attribute>
        <attribute name="validation_groups">sylius</attribute>
        <attribute name="output">false</attribute>

        <collectionOperations>
            <collectionOperation name="shop_resend_verification_email">
                <attribute name="method">POST</attribute>
                <attribute name="path">/customers/verify</attribute>
                <attribute name="input">Sylius\Bundle\ApiBundle\Command\Account\ResendVerificationEmail</attribute>
                <attribute name="status">202</attribute>
                <attribute name="denormalization_context">
                    <attribute name="groups">
                        <attribute>shop:resend_verification_email:create</attribute>
                        <attribute>sylius:shop:resend_verification_email:create</attribute>
                    </attribute>
                </attribute>
                <attribute name="openapi_context">
                    <attribute name="summary">Resends verification email.</attribute>
                </attribute>
                <attribute name="security">is_granted("ROLE_USER")</attribute>
            </collectionOperation>
        </collectionOperations>

        <itemOperations>
            <itemOperation name="shop_verify_customer_account">
                <attribute name="method">PATCH</attribute>
                <attribute name="path">/customers/verify/{token}</attribute>
                <attribute name="input">Sylius\Bundle\ApiBundle\Command\Account\VerifyCustomerAccount</attribute>
                <attribute name="status">202</attribute>
                <attribute name="denormalization_context">
                    <attribute name="groups">
                        <attribute>shop:account_verification:update</attribute>
                        <attribute>sylius:shop:account_verification:update</attribute>
                    </attribute>
                </attribute>
                <attribute name="openapi_context">
                    <attribute name="summary">Verifies Customer account.</attribute>
                </attribute>
            </itemOperation>
        </itemOperations>

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