<?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.channel.class%" shortName="Channel">
        <collectionOperations>
            <collectionOperation name="admin_get">
                <attribute name="method">GET</attribute>
                <attribute name="path">/admin/channels</attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>admin:channel:index</attribute>
                        <attribute>sylius:admin:channel:index</attribute>
                    </attribute>
                </attribute>
            </collectionOperation>

            <collectionOperation name="shop_get">
                <attribute name="method">GET</attribute>
                <attribute name="path">/shop/channels</attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>shop:channel:index</attribute>
                        <attribute>sylius:shop:channel:index</attribute>
                    </attribute>
                </attribute>
            </collectionOperation>

            <collectionOperation name="admin_post">
                <attribute name="method">POST</attribute>
                <attribute name="path">/admin/channels</attribute>
                <attribute name="denormalization_context">
                    <attribute name="groups">
                        <attribute>admin:channel:create</attribute>
                        <attribute>sylius:admin:channel:create</attribute>
                    </attribute>
                </attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>admin:channel:show</attribute>
                        <attribute>sylius:admin:channel:show</attribute>
                    </attribute>
                </attribute>
                <attribute name="validation_groups">sylius</attribute>
            </collectionOperation>
        </collectionOperations>

        <itemOperations>
            <itemOperation name="admin_get">
                <attribute name="method">GET</attribute>
                <attribute name="path">/admin/channels/{code}</attribute>
                <attribute name="openapi_context">
                    <attribute name="summary">Use $code to retrieve a channel resource.</attribute>
                </attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>admin:channel:show</attribute>
                        <attribute>sylius:admin:channel:show</attribute>
                    </attribute>
                </attribute>
            </itemOperation>

            <itemOperation name="shop_get">
                <attribute name="method">GET</attribute>
                <attribute name="path">/shop/channels/{code}</attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>shop:channel:show</attribute>
                        <attribute>sylius:shop:channel:show</attribute>
                    </attribute>
                </attribute>
                <attribute name="openapi_context">
                    <attribute name="summary">Use $code to retrieve a channel resource.</attribute>
                </attribute>
            </itemOperation>

            <itemOperation name="admin_put">
                <attribute name="method">PUT</attribute>
                <attribute name="path">/admin/channels/{code}</attribute>
                <attribute name="denormalization_context">
                    <attribute name="groups">
                        <attribute>admin:channel:update</attribute>
                        <attribute>sylius:admin:channel:update</attribute>
                    </attribute>
                </attribute>
                <attribute name="normalization_context">
                    <attribute name="groups">
                        <attribute>admin:channel:show</attribute>
                        <attribute>sylius:admin:channel:show</attribute>
                    </attribute>
                </attribute>
                <attribute name="validation_groups">sylius</attribute>
            </itemOperation>

            <itemOperation name="admin_delete">
                <attribute name="method">DELETE</attribute>
                <attribute name="path">/admin/channels/{code}</attribute>
            </itemOperation>
        </itemOperations>

        <subresourceOperations>
            <subresourceOperation name="shop_billing_data_get_subresource">
                <attribute name="method">GET</attribute>
                <attribute name="path">/admin/channels/{code}/shop-billing-data</attribute>
            </subresourceOperation>
        </subresourceOperations>

        <property name="id" identifier="false" writable="false" />
        <property name="code" identifier="true" required="true" />
        <property name="name" writable="true" readable="true" />
        <property name="enabled" writable="true" readable="true" />
        <property name="description" writable="true" readable="true" />
        <property name="hostname" writable="true" readable="true" />
        <property name="color" writable="true" readable="true" />
        <property name="baseCurrency" writable="true" readable="true" />
        <property name="defaultLocale" writable="true" readable="true" />
        <property name="defaultTaxZone" writable="true" readable="true" />
        <property name="taxCalculationStrategy" writable="true" readable="true" />
        <property name="currencies" writable="true" readable="true" />
        <property name="locales" writable="true" readable="true" />
        <property name="countries" writable="true" readable="true" />
        <property name="themeName" writable="true" readable="true" />
        <property name="contactEmail" writable="true" readable="true" />
        <property name="contactPhoneNumber" writable="true" readable="true" />
        <property name="skippingShippingStepAllowed" writable="true" readable="true" />
        <property name="skippingPaymentStepAllowed" writable="true" readable="true" />
        <property name="accountVerificationRequired" writable="true" readable="true" />
        <property name="shippingAddressInCheckoutRequired" writable="true" readable="true" />
        <property name="shopBillingData" readable="true" writable="true">
            <subresource resourceClass="%sylius.model.shop_billing_data.class%" collection="false" />
        </property>
        <property name="menuTaxon" writable="true" readable="true" />
        <property name="channelPriceHistoryConfig" writable="true" readable="true" />
    </resource>
</resources>
