<?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.model.address.class%" shortName="Address">
        <attribute name="validation_groups">sylius</attribute>

        <collectionOperations>
            <collectionOperation name="shop_get">
                <attribute name="method">GET</attribute>
                <attribute name="path">/shop/addresses</attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>shop:address:index</attribute>
                        <attribute>sylius:shop:address:index</attribute>
                    </attribute>
                </attribute>
            </collectionOperation>

            <collectionOperation name="shop_post">
                <attribute name="method">POST</attribute>
                <attribute name="path">/shop/addresses</attribute>
                <attribute name="denormalization_context">
                    <attribute name="groups">
                        <attribute>shop:address:create</attribute>
                        <attribute>sylius:shop:address:create</attribute>
                    </attribute>
                </attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>shop:address:show</attribute>
                        <attribute>sylius:shop:address:show</attribute>
                    </attribute>
                </attribute>
            </collectionOperation>
        </collectionOperations>

        <itemOperations>
            <itemOperation name="admin_get">
                <attribute name="method">GET</attribute>
                <attribute name="path">/admin/addresses/{id}</attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>admin:address:show</attribute>
                        <attribute>sylius:admin:address:show</attribute>
                    </attribute>
                </attribute>
            </itemOperation>

            <itemOperation name="admin_put">
                <attribute name="method">PUT</attribute>
                <attribute name="path">/admin/addresses/{id}</attribute>
                <attribute name="denormalization_context">
                    <attribute name="groups">
                        <attribute>admin:address:update</attribute>
                        <attribute>sylius:admin:address:update</attribute>
                    </attribute>
                </attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>admin:address:show</attribute>
                        <attribute>sylius:admin:address:show</attribute>
                    </attribute>
                </attribute>
            </itemOperation>

            <itemOperation name="admin_get_log_entries">
                <attribute name="method">GET</attribute>
                <attribute name="path">/admin/addresses/{id}/log-entries</attribute>
                <attribute name="controller">Sylius\Bundle\ApiBundle\Controller\GetAddressLogEntryCollectionAction</attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>admin:address:log_entry:show</attribute>
                        <attribute>sylius:admin:address:log_entry:show</attribute>
                    </attribute>
                </attribute>
                <attribute name="openapi_context">
                    <attribute name="summary">Retrieves the collection of AddressLogEntry resources.</attribute>
                    <attribute name="description">Retrieves the collection of AddressLogEntry resources</attribute>
                </attribute>
            </itemOperation>

            <itemOperation name="shop_get">
                <attribute name="method">GET</attribute>
                <attribute name="path">/shop/addresses/{id}</attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>shop:address:show</attribute>
                        <attribute>sylius:shop:address:show</attribute>
                    </attribute>
                </attribute>
            </itemOperation>

            <itemOperation name="shop_delete">
                <attribute name="method">DELETE</attribute>
                <attribute name="path">/shop/addresses/{id}</attribute>
            </itemOperation>

            <itemOperation name="shop_put">
                <attribute name="method">PUT</attribute>
                <attribute name="path">/shop/addresses/{id}</attribute>
                <attribute name="denormalization_context">
                    <attribute name="groups">
                        <attribute>shop:address:update</attribute>
                        <attribute>sylius:shop:address:update</attribute>
                    </attribute>
                </attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>shop:address:show</attribute>
                        <attribute>sylius:shop:address:show</attribute>
                    </attribute>
                </attribute>
            </itemOperation>
        </itemOperations>

        <property name="id" identifier="true" writable="false" />
        <property name="firstName" writable="true" />
        <property name="lastName" writable="true" />
        <property name="city" writable="true" />
        <property name="street" writable="true" />
        <property name="postcode" writable="true" />
        <property name="countryCode" writable="true" />
        <property name="provinceCode" writable="true" />
        <property name="provinceName" writable="true" />
    </resource>
</resources>
