{
    "name": "Turn 14",
    "app_type": "turn14",
    "sync_type": "api",
    "is_active": true,
    "debug_mode": false,
    "authorization": {
        "auth_type": "oauth2",
        "auth_settings": {
            "request_settings": {
                "grant_type": "client_credentials",
                "access_token_url": "https://api<domain>.turn14.com/v1/token",
                "client_id": "<client_id>",
                "client_secret": "<client_secret>",
                "send_client_credentials": [
                    "body"
                ],
                "authorization_header_name": "Authorization"
            },
            "response_settings": {
                "token_key": "access_token",
                "token_type": "Bearer",
                "expires_in_key": "expires_in"
            }
        }
    },
    "connections": [
        {
            "name": "Items",
            "type": "api",
            "is_active": true,
            "is_primary": true,
            "resource_type": "product",
            "priority": 1,
            "configuration": {
                "auth_enabled": true,
                "method": "GET",
                "endpoint": "https://api<domain>.turn14.com/v1/items",
                "headers": {
                    "Content-Type": "application/json",
                    "Accept": "application/json"
                },
                "body": {},
                "prerequisites": {
                    "product_response": "data",
                    "variable_response": null,
                    "main_product_unique_identifier": "id",
                    "variable_product_unique_identifier": ""
                },
                "advanced_configuration": {}
            }
        },
        {
            "name": "Pricing",
            "type": "api",
            "is_active": true,
            "is_primary": false,
            "resource_type": "product",
            "priority": 2,
            "configuration": {
                "auth_enabled": true,
                "method": "GET",
                "endpoint": "https://api<domain>.turn14.com/v1/pricing",
                "headers": {
                    "Content-Type": "application/json",
                    "Accept": "application/json"
                },
                "body": {},
                "prerequisites": {
                    "product_response": "data",
                    "variable_response": null,
                    "main_product_unique_identifier": "id",
                    "variable_product_unique_identifier": ""
                },
                "advanced_configuration": {}
            }
        },
        {
            "name": "Stock",
            "type": "api",
            "is_active": true,
            "is_primary": false,
            "resource_type": "product",
            "priority": 3,
            "configuration": {
                "auth_enabled": true,
                "method": "GET",
                "endpoint": "https://api<domain>.turn14.com/v1/inventory",
                "headers": {
                    "Content-Type": "application/json",
                    "Accept": "application/json"
                },
                "body": {},
                "prerequisites": {
                    "product_response": "data",
                    "variable_response": null,
                    "main_product_unique_identifier": "id",
                    "variable_product_unique_identifier": ""
                },
                "advanced_configuration": {}
            }
        },
        {
            "name": "Images",
            "type": "api",
            "is_active": true,
            "is_primary": false,
            "resource_type": "product",
            "priority": 4,
            "configuration": {
                "auth_enabled": true,
                "method": "GET",
                "endpoint": "https://api<domain>.turn14.com/v1/items/data",
                "headers": {
                    "Content-Type": "application/json",
                    "Accept": "application/json"
                },
                "body": {},
                "prerequisites": {
                    "product_response": "data",
                    "variable_response": null,
                    "main_product_unique_identifier": "id",
                    "variable_product_unique_identifier": ""
                },
                "advanced_configuration": {}
            }
        },
        {
            "name": "Order",
            "type": "api",
            "is_active": false,
            "is_primary": false,
            "resource_type": "order",
            "priority": 5,
            "configuration": {
                "body": {
                    "data": {
                        "data": {
                            "locations": [
                                {
                                    "items": [
                                        {
                                            "quantity": 1,
                                            "item_identifier": "100000",
                                            "item_identifier_type": "item_id"
                                        },
                                        {
                                            "quantity": 3,
                                            "item_identifier": "1000",
                                            "item_identifier_type": "item_id"
                                        }
                                    ],
                                    "location": "default",
                                    "combine_in_out_stock": false
                                }
                            ],
                            "po_number": "123456",
                            "recipient": {
                                "zip": "19044",
                                "city": "Horsham",
                                "name": "John Doe",
                                "state": "PA",
                                "address": "100 Tournament Drive",
                                "company": "Turn 14 Distribution",
                                "country": "US",
                                "address_2": "Suite 100",
                                "phone_number": "267-468-0350",
                                "email_address": "you@me.com",
                                "is_shop_address": false
                            },
                            "environment": "testing",
                            "sales_source": 1
                        }
                    },
                    "type": "json"
                },
                "method": "POST",
                "headers": {
                    "Content-Type": "application/json"
                },
                "endpoint": "https://api<domain>.turn14.com/v1/order/from_quote",
                "auth_enabled": true,
                "prerequisites": {
                    "product_response": "",
                    "prerequisite_type": "no-variations",
                    "variable_response": null,
                    "prerequisite_variation_type": "group-variations",
                    "main_product_unique_identifier": "id",
                    "variable_product_unique_identifier": ""
                },
                "advanced_configuration": {
                    "time_delay": ""
                }
            }
        }
    ],
    "attribute_mapping": [
        {
            "connection": "Items",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "sku",
            "supplier_attribute": "attributes->part_number",
            "advanced_configuration": null
        },
        {
            "connection": "Items",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "name",
            "supplier_attribute": "attributes->product_name",
            "advanced_configuration": null
        },
        {
            "connection": "Items",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "description",
            "supplier_attribute": "attributes->part_description",
            "advanced_configuration": null
        },
        {
            "connection": "Stock",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "stock_quantity",
            "supplier_attribute": "attributes->inventory->01",
            "advanced_configuration": null
        },
        {
            "connection": "Pricing",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "regular_price",
            "supplier_attribute": "attributes->pricelists->0->price",
            "advanced_configuration": null
        },
        {
            "connection": "Images",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "images",
            "supplier_attribute": "files",
            "advanced_configuration": {
                "translation": {
                    "is_active": false,
                    "attributes": [
                        {
                            "apiValue": "",
                            "condition": "equals",
                            "translatedValue": ""
                        }
                    ]
                },
                "image_src_attr": "links->0->url",
                "image_path_attr": "",
                "fetch_from_other_api": {
                    "is_active": false,
                    "connection": ""
                }
            }
        }
    ],
    "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": [
                "Items"
            ]
        },
        {
            "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": "out_of_stock",
                    "products_of": "this-supplier"
                }
            },
            "connections": [
                "Pricing"
            ]
        },
        {
            "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": "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": [
                "Images"
            ]
        },
        {
            "operation": "page",
            "operation_type": "performance-optimization",
            "is_active": true,
            "configuration": {
                "type": "regular",
                "location": "query-parameter",
                "page_param": "page",
                "limit_param": "",
                "limit_value": ""
            },
            "connections": [
                "Items"
            ]
        },
        {
            "operation": "page",
            "operation_type": "performance-optimization",
            "is_active": true,
            "configuration": {
                "type": "regular",
                "location": "query-parameter",
                "page_param": "page",
                "limit_param": "",
                "limit_value": ""
            },
            "connections": [
                "Pricing"
            ]
        },
        {
            "operation": "page",
            "operation_type": "performance-optimization",
            "is_active": true,
            "configuration": {
                "type": "regular",
                "location": "query-parameter",
                "page_param": "page",
                "limit_param": "",
                "limit_value": ""
            },
            "connections": [
                "Stock"
            ]
        },
        {
            "operation": "page",
            "operation_type": "performance-optimization",
            "is_active": true,
            "configuration": {
                "type": "regular",
                "location": "query-parameter",
                "page_param": "page",
                "limit_param": "",
                "limit_value": ""
            },
            "connections": [
                "Images"
            ]
        }
    ],
    "order_sync": [
        {
            "name": "Order",
            "connection_id": "Order",
            "is_active": false,
            "configuration": {
                "order_suppliers": [
                    "<supplier_id>"
                ],
                "direct_association": {
                    "data->po_number": "id",
                    "data->environment": "##testing##",
                    "data->sales_source": "##1##",
                    "data->recipient->zip": "shipping->postcode",
                    "data->recipient->city": "shipping->city",
                    "data->recipient->name": "shipping->first_name+## ## + shipping->last_name",
                    "data->recipient->state": "shipping->state",
                    "data->recipient->address": "shipping->address_1",
                    "data->recipient->company": "shipping->company",
                    "data->recipient->country": "shipping->country",
                    "data->recipient->address_2": "shipping->address_2",
                    "data->locations->0->location": "##default##",
                    "data->recipient->phone_number": "shipping->phone",
                    "data->recipient->is_shop_address": "##0##",
                    "data->locations->0->combine_in_out_stock": "##0##"
                },
                "nested_association": [
                    {
                        "direct_association": [
                            {
                                "wooKey": "product_meta->_mo_unique_product_id->0",
                                "vendorKey": "item_identifier"
                            },
                            {
                                "wooKey": "purchase_quantity",
                                "vendorKey": "quantity"
                            },
                            {
                                "wooKey": "##item_id##",
                                "vendorKey": "item_identifier_type"
                            }
                        ],
                        "data->locations->0->items": "line_items"
                    }
                ]
            },
            "is_conditional_sync_enabled": false
        }
    ]
}