imports:
#    - { resource: 'elastic-search.yaml' }

pimcore:
    models:
        class_overrides:
            Pimcore\Model\DataObject\Car: App\Model\Product\Car
            Pimcore\Model\DataObject\AccessoryPart: App\Model\Product\AccessoryPart
            Pimcore\Model\DataObject\Category: App\Model\Product\Category


pimcore_ecommerce_framework:

    environment:
        # TODO integrate that implementation into core
        environment_id: App\Ecommerce\Overrides\Environment

    # Configuration of price systems - key is name of price system
    price_systems:
        default:
            # Price system defined and configured as container service
            id: app.default_price_system

    index_service:
        tenants:
            default:
                config_id: App\Ecommerce\IndexService\Config\MySqlConfig
                worker_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Worker\DefaultMysql
                search_attributes:
                    - name
                    - manufacturer_name
                    - color
                    - carClass
                attributes:
                    name:
                        fieldname: OSName
                        type: varchar(255)
                        filter_group: string
                    manufacturer_name:
                        fieldname: 'manufacturer'
                        type: varchar(255)
                        interpreter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Interpreter\ObjectValue
                        interpreter_options:
                            target:
                                fieldname: name
                                locale: 'en'
                        filter_group: string
                    manufacturer:
                        interpreter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Interpreter\DefaultObjects
                        filter_group: relation
                    bodyStyle:
                        interpreter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Interpreter\DefaultObjects
                        filter_group: relation
                    carClass:
                        type: varchar(255)
                        filter_group: string
                    color:
                        type: varchar(255)
                        filter_group: multiselect
                    country:
                        type: varchar(10)
                        filter_group: string
                    milage:
                        type: double
                        interpreter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Interpreter\QuantityValue
                        interpreter_options:
                            onlyValue: true
                        getter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Getter\DefaultBrickGetterSequence
                        getter_options:
                            source:
                                -   brickfield: saleInformation
                                    bricktype: SaleInformation
                                    fieldname: milage
                        filtergroup: double

                    length:
                        type: double
                        interpreter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Interpreter\QuantityValue
                        interpreter_options:
                            onlyValue: true
                        getter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Getter\DefaultBrickGetterSequence
                        getter_options:
                            source:
                                - brickfield: attributes
                                  bricktype: dimensions
                                  fieldname: length
                        filtergroup: double

                    width:
                        type: double
                        interpreter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Interpreter\QuantityValue
                        interpreter_options:
                            onlyValue: true
                        getter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Getter\DefaultBrickGetterSequence
                        getter_options:
                            source:
                                - brickfield: attributes
                                  bricktype: dimensions
                                  fieldname: width
                        filtergroup: double
                    wheelbase:
                        type: double
                        interpreter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Interpreter\QuantityValue
                        interpreter_options:
                            onlyValue: true
                        getter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Getter\DefaultBrickGetterSequence
                        getter_options:
                            source:
                                - brickfield: attributes
                                  bricktype: dimensions
                                  fieldname: wheelbase
                        filtergroup: double
                    weight:
                        type: double
                        interpreter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Interpreter\QuantityValue
                        interpreter_options:
                            onlyValue: true
                        getter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Getter\DefaultBrickGetterSequence
                        getter_options:
                            source:
                                - brickfield: attributes
                                  bricktype: dimensions
                                  fieldname: weight
                        filtergroup: double

                    power:
                        type: double
                        interpreter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Interpreter\QuantityValue
                        interpreter_options:
                            onlyValue: true
                        getter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Getter\DefaultBrickGetterSequence
                        getter_options:
                            source:
                                - brickfield: attributes
                                  bricktype: engine
                                  fieldname: power
                        filtergroup: double


                    segments:
                        getter_id: App\Ecommerce\IndexService\SegmentGetter
                        interpreter_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Interpreter\DefaultObjects
                        filter_group: relation

    filter_service:

        # Configure assortment tenants - at least one tenant has to be configured
        # If a _defaults key is set, it will be merged into every tenant.
        tenants:
            default:
                # Assign backend implementations and views to filter type field collections
                filter_types:
                    FilterInputfield:
                        # Service id for filter type implementation
                        filter_type_id: Pimcore\Bundle\EcommerceFrameworkBundle\FilterService\FilterType\Input
                        # Default template for filter, can be overwritten in filter definition
                        template: 'product/filters/input.html.twig'

                    FilterNumberRange:
                        filter_type_id: Pimcore\Bundle\EcommerceFrameworkBundle\FilterService\FilterType\NumberRange
                        template: 'product/filters/numberrange.html.twig'

                    FilterNumberRangeSelection:
                        filter_type_id: Pimcore\Bundle\EcommerceFrameworkBundle\FilterService\FilterType\NumberRangeSelection
                        template: 'product/filters/numberrange_select.html.twig'

                    FilterSelect:
                        filter_type_id: Pimcore\Bundle\EcommerceFrameworkBundle\FilterService\FilterType\Select
                        template: 'product/filters/select.html.twig'

                    FilterSelectFromMultiSelect:
                        filter_type_id: Pimcore\Bundle\EcommerceFrameworkBundle\FilterService\FilterType\SelectFromMultiSelect
                        template: 'product/filters/select.html.twig'

                    FilterMultiSelect:
                        filter_type_id: Pimcore\Bundle\EcommerceFrameworkBundle\FilterService\FilterType\MultiSelect
                        template: 'product/filters/multi_select.html.twig'

                    FilterMultiSelectFromMultiSelect:
                        filter_type_id: Pimcore\Bundle\EcommerceFrameworkBundle\FilterService\FilterType\MultiSelectFromMultiSelect
                        template: 'product/filters/multi_select.html.twig'

                    FilterMultiRelation:
                        filter_type_id: Pimcore\Bundle\EcommerceFrameworkBundle\FilterService\FilterType\MultiSelectRelation
                        template: 'product/filters/multi_relation.html.twig'

                    FilterCategory:
                        filter_type_id: Pimcore\Bundle\EcommerceFrameworkBundle\FilterService\FilterType\SelectCategory
                        template: 'product/filters/select_category.html.twig'

                    FilterRelation:
                        filter_type_id: Pimcore\Bundle\EcommerceFrameworkBundle\FilterService\FilterType\SelectRelation
                        template: 'product/filters/object_relation.html.twig'


    cart_manager:
        tenants:
            default:
                price_calculator:
                    modificators:
                        Shipping:
                            class: App\Ecommerce\Cart\PriceModificator\Shipping
                            options:
                                baseCharge: "10"
                                carCharge: "200"


    checkout_manager:
        tenants:
            default:
                payment:
                    provider: paypal
                steps:
                    deliveryaddress:
                        class: \Pimcore\Bundle\EcommerceFrameworkBundle\CheckoutManager\DeliveryAddress
                    confirm:
                        class: \App\Ecommerce\CheckoutManager\Confirm


    order_manager:
        tenants:
            default:
                options:
                    parent_order_folder: /Shop/Orders/%%Y/%%m/%%d

    payment_manager:
        # Service id of payment manager implementation - following value is default value an can be omitted
        #        payment_manager_id: Pimcore\Bundle\EcommerceFrameworkBundle\PaymentManager\PaymentManager

        # Configuration of payment providers, key is name of provider
        providers:
            paypal:
                provider_id: Pimcore\Bundle\EcommerceFrameworkBundle\PaymentManager\Payment\PayPalSmartPaymentButton
                profile: sandbox
                profiles:
                    sandbox:
                        client_id: '%env(paypal_client_id)%'
                        client_secret: '%env(paypal_secret_id)%'

                        # defines, if payment caputure should take place automatic or manual, default is automatic
                        capture_strategy: automatic

                        # defines mode of PayPal API, default value is sandbox
                        mode: sandbox

                        # defines PayPal application context for shipping, default value is NO_SHIPPING
                        # see https://developer.paypal.com/docs/api/orders/v2/#definition-application_context
                        shipping_preference: NO_SHIPPING

                        # defines PayPal application context for user action, default value is PAY_NOW
                        # see https://developer.paypal.com/docs/api/orders/v2/#definition-application_context
                        user_action: PAY_NOW

                    live:
                        client_id: <YOUR PAYPAL REST API CLIENT ID>
                        client_secret: <YOUR PAYPAL REST API CLIENT SECRET>
                        mode: live

    # tracking manager - define which trackers (e.g. Google Analytics Universal Ecommerce) are active and should
    # be called when you track something via TrackingManager
    tracking_manager:
        trackers:
            enhanced_ecommerce:
                enabled: true
               # item_builder_id: App\Ecommerce\Tracking\TrackingItemBuilder

#            my_custom_tracker:
#                # use already defined enhanced ecommerce tracker
#                id: Pimcore\Bundle\EcommerceFrameworkBundle\Tracking\Tracker\Analytics\EnhancedEcommerce
#
#                # options vary by tracker implementation
#                options:
#                    template_prefix: AppBundle:Tracking/analytics/enhanced
#
#                # service id for item builder
#                item_builder_id: App\Ecommerce\Tracking\TrackingItemBuilder
#
#                # List of assortment and checkout tenants where this tracker should be activated for.
#                tenants:
#
#                    # Add list of assortment tenants where the tracker should be activated for. Empty array means activated for all tenants.
#                    assortment:           []
#
#                    # Add list of checkout tenants where the tracker should be activated for. Empty array means activated for all tenants.
#                    checkout:             []

services:

    _defaults:
        autowire: true
        autoconfigure: true

    # Custom service definitions for index service
    App\Ecommerce\IndexService\Config\MySqlConfig:
        parent: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Config\AbstractConfig
        autowire: true
        autoconfigure: false


    App\Ecommerce\IndexService\SegmentGetter: ~


    # define own price system service and configure options for attribute name and price object class
    app.default_price_system:
        class: Pimcore\Bundle\EcommerceFrameworkBundle\PriceSystem\AttributePriceSystem
        arguments:
            $options:
                attribute_name: price


    Pimcore\Localization\IntlFormatter:
        public: true
        calls:
            - [setCurrencyFormat, ['en', '¤¤ #,##0.00']]
            - [setCurrencyFormat, ['de', '#,##0.00 ¤¤']]

    App\Ecommerce\Overrides\Environment:
        parent: Pimcore\Bundle\EcommerceFrameworkBundle\Environment
        autowire: true
        autoconfigure: false
