{
    "name": "Midocean",
    "app_type": "midocean",
    "sync_type": "api",
    "is_active": true,
    "debug_mode": false,
    "authorization": {
        "auth_type": "api-key",
        "auth_settings": {
            "key": "x-Gateway-APIKey",
            "secret": "<api_key>"
        }
    },
    "connections": [
        {
            "name": "Products",
            "type": "api",
            "is_active": true,
            "is_primary": true,
            "resource_type": "product",
            "priority": 1,
            "configuration": {
                "auth_enabled": true,
                "method": "GET",
                "endpoint": "https://api.midocean.com/gateway/products/2.0?language=en",
                "headers": {
                    "Content-Type": "application/json",
                    "Accept": "application/json"
                },
                "body": {},
                "prerequisites": {
                    "product_response": "",
                    "variable_response": {
                        "variable_path": "variants"
                    },
                    "main_product_unique_identifier": "master_code",
                    "variable_product_unique_identifier": "sku"
                },
                "advanced_configuration": {}
            }
        },
        {
            "name": "Prices",
            "type": "api",
            "is_active": true,
            "is_primary": false,
            "resource_type": "product",
            "priority": 2,
            "configuration": {
                "auth_enabled": true,
                "method": "GET",
                "endpoint": "https://api.midocean.com/gateway/pricelist/2.0/",
                "headers": {
                    "Content-Type": "application/json",
                    "Accept": "application/json"
                },
                "body": {},
                "prerequisites": {
                    "product_response": "price",
                    "variable_response": null,
                    "main_product_unique_identifier": "sku",
                    "variable_product_unique_identifier": ""
                }
            }
        },
        {
            "name": "Stock",
            "type": "api",
            "is_active": true,
            "is_primary": false,
            "resource_type": "product",
            "priority": 3,
            "configuration": {
                "auth_enabled": true,
                "method": "GET",
                "endpoint": "https://api.midocean.com/gateway/stock/2.0",
                "headers": {},
                "body": {},
                "prerequisites": {
                    "product_response": "stock",
                    "variable_response": null,
                    "main_product_unique_identifier": "sku",
                    "variable_product_unique_identifier": ""
                }
            }
        },
        {
            "name": "Midocean Branding",
            "type": "api",
            "is_active": true,
            "is_primary": false,
            "resource_type": "product",
            "priority": 4,
            "configuration": {
                "auth_enabled": true,
                "method": "GET",
                "endpoint": "https://api.midocean.com/gateway/printdata/1.0",
                "headers": {
                    "Content-Type": "application/json",
                    "Accept": "application/json"
                },
                "body": {},
                "prerequisites": {},
                "advanced_configuration": {}
            }
        },
        {
            "name": "Midocean Branding Prices",
            "type": "api",
            "is_active": true,
            "is_primary": false,
            "resource_type": "product",
            "priority": 5,
            "configuration": {
                "auth_enabled": true,
                "method": "GET",
                "endpoint": "https://api.midocean.com/gateway/printpricelist/2.0/",
                "headers": {
                    "Content-Type": "application/json",
                    "Accept": "application/json"
                },
                "body": {},
                "prerequisites": {},
                "advanced_configuration": {}
            }
        },
        {
            "name": "Order",
            "type": "api",
            "is_active": false,
            "is_primary": false,
            "resource_type": "order",
            "priority": 4,
            "configuration": {
                "method": "POST",
                "endpoint": "https://api.midocean.com/gateway/order/2.1/create",
                "auth_enabled": true,
                "headers": {
                    "Content-Type": "application/json",
                    "Accept": "application/json"
                },
                "body": {
                    "type": "json",
                    "data": {
                        "order_header": {
                            "preferred_shipping_date": "2024-05-01",
                            "check_price": "false",
                            "currency": "EUR",
                            "contact_email": "Contact e-mail",
                            "shipping_address": {
                                "contact_name": "Contact name",
                                "company_name": "Company name",
                                "street1": "Street",
                                "postal_code": "Postal code",
                                "city": "City",
                                "region": "",
                                "country": "IT",
                                "email": "contact e-mail",
                                "phone": "phone"
                            },
                            "po_number": "your order referencce",
                            "timestamp": "2024-04-24T00:00:00",
                            "contact_name": "Contact name",
                            "order_type": "NORMAL"
                        },
                        "order_lines": [
                            {
                                "order_line_id": "1",
                                "sku": "KC3314-32",
                                "quantity": "10",
                                "expected_price": "0"
                            }
                        ]
                    }
                },
                "prerequisites": {
                    "product_response": "",
                    "prerequisite_type": "no-variations",
                    "prerequisite_variation_type": "group-variations",
                    "variable_response": null,
                    "main_product_unique_identifier": "1234",
                    "variable_product_unique_identifier": ""
                },
                "advanced_configuration": {
                    "time_delay": ""
                }
            }
        }
    ],
    "attribute_mapping": [
        {
            "connection": "Products",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "sku",
            "supplier_attribute": "master_code",
            "advanced_configuration": null
        },
        {
            "connection": "Products",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "name",
            "supplier_attribute": "product_name",
            "advanced_configuration": null
        },
        {
            "connection": "Products",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "description",
            "supplier_attribute": "long_description",
            "advanced_configuration": null
        },
        {
            "connection": "Products",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "images",
            "supplier_attribute": "variants->0->digital_assets",
            "advanced_configuration": {
                "image_src_attr": "url"
            }
        },
        {
            "connection": "Prices",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "sku",
            "supplier_attribute": "sku",
            "advanced_configuration": null
        },
        {
            "connection": "Prices",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "regular_price",
            "supplier_attribute": "price",
            "advanced_configuration": null
        },
        {
            "connection": "Stock",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "sku",
            "supplier_attribute": "sku",
            "advanced_configuration": null
        },
        {
            "connection": "Stock",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "stock_quantity",
            "supplier_attribute": "qty",
            "advanced_configuration": null
        }
    ],
    "operations": [
        {
            "operation": "product-operations",
            "operation_type": "data-sync",
            "is_active": true,
            "configuration": {
                "available_products": {
                    "add": true,
                    "update": true,
                    "update_product_status": false,
                    "product_status": "publish"
                },
                "unavailable_products": {
                    "operation": "none",
                    "products_of": "none"
                }
            },
            "connections": [
                "Products"
            ]
        },
        {
            "operation": "product-operations",
            "operation_type": "data-sync",
            "is_active": true,
            "configuration": {
                "available_products": {
                    "add": false,
                    "update": true,
                    "update_product_status": false,
                    "product_status": "publish"
                },
                "unavailable_products": {
                    "operation": "none",
                    "products_of": "none"
                }
            },
            "connections": [
                "Prices"
            ]
        },
        {
            "operation": "product-operations",
            "operation_type": "data-sync",
            "is_active": true,
            "configuration": {
                "available_products": {
                    "add": false,
                    "update": true,
                    "update_product_status": false,
                    "product_status": "publish"
                },
                "unavailable_products": {
                    "operation": "none",
                    "products_of": "none"
                }
            },
            "connections": [
                "Stock"
            ]
        },
        {
            "operation": "batch",
            "operation_type": "performance-optimization",
            "is_active": true,
            "configuration": {
                "batch_size": 100
            },
            "connections": [
                "Products"
            ]
        },
        {
            "operation": "batch",
            "operation_type": "performance-optimization",
            "is_active": true,
            "configuration": {
                "batch_size": 100
            },
            "connections": [
                "Prices"
            ]
        },
        {
            "operation": "batch",
            "operation_type": "performance-optimization",
            "is_active": true,
            "configuration": {
                "batch_size": 100
            },
            "connections": [
                "Stock"
            ]
        }
    ],
    "order_sync": [
        {
            "name": "Order",
            "connection_id": "Order",
            "is_active": false,
            "configuration": {
                "order_suppliers": [
                    "<supplier_id>"
                ],
                "direct_association": {
                    "order_header->check_price": "##FALSE##",
                    "order_header->contact_email": "billing->email",
                    "order_header->currency": "currency",
                    "order_header->po_number": "####+id",
                    "order_header->timestamp": "date_created",
                    "order_header->contact name": "shipping->first_name",
                    "order_header->order_type": "##NORMAL##"
                },
                "nested_association": [
                    {
                        "order_header->shipping_address": "shipping",
                        "direct_association": [
                            {
                                "vendorKey": "contact_name",
                                "wooKey": "first_name"
                            },
                            {
                                "vendorKey": "company_name",
                                "wooKey": "company"
                            },
                            {
                                "vendorKey": "street1",
                                "wooKey": "address_1"
                            },
                            {
                                "vendorKey": "postal_code",
                                "wooKey": "postcode"
                            },
                            {
                                "vendorKey": "city",
                                "wooKey": "city"
                            },
                            {
                                "vendorKey": "region",
                                "wooKey": "state"
                            },
                            {
                                "vendorKey": "country",
                                "wooKey": "country"
                            },
                            {
                                "vendorKey": "phone",
                                "wooKey": "phone"
                            }
                        ]
                    },
                    {
                        "order_lines": "line_items",
                        "direct_association": [
                            {
                                "vendorKey": "order_line_id",
                                "wooKey": "####+id"
                            },
                            {
                                "vendorKey": "sku",
                                "wooKey": "sku"
                            },
                            {
                                "vendorKey": "quantity",
                                "wooKey": "####+purchase_quantity"
                            },
                            {
                                "vendorKey": "expected_price",
                                "wooKey": "regular_price"
                            }
                        ]
                    }
                ]
            },
            "is_conditional_sync_enabled": false
        }
    ]
}