{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "shopware-cli",
    "description": "shopware cli project configuration definition file",
    "$ref": "#/definitions/Config",
    "definitions": {
        "Config": {
            "type": "object",
            "title": ".shopware-project.yml",
            "additionalProperties": false,
            "properties": {
                "url": {
                    "type": "string",
                    "description": "URL to Shopware instance"
                },
                "admin_api": {
                    "$ref": "#/definitions/AdminApi"
                },
                "dump": {
                    "$ref": "#/definitions/Dump"
                },
                "sync": {
                    "$ref": "#/definitions/Sync"
                },
                "build": {
                    "$ref": "#/definitions/Build"
                }
            }
        },
        "Build": {
            "type": "object",
            "title": "Project Build Settings",
            "additionalProperties": false,
            "properties": {
                "disable_asset_copy": {
                    "type": "boolean",
                    "description": "When enabled, the assets will not be copied to the public folder",
                    "default": false
                },
                "remove_extension_assets": {
                    "type": "boolean",
                    "description": "When enabled, the assets of extensions will be removed from the extension public folder. (Requires Shopware 6.5.2.0)",
                    "default": false
                },
                "cleanup_paths": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "Paths to delete for the final build"
                }
            }
        },
        "AdminApi": {
            "type": "object",
            "title": "Admin API credentials",
            "additionalProperties": false,
            "properties": {
                "client_id": {
                    "type": "string",
                    "description": "Client ID of integration"
                },
                "client_secret": {
                    "type": "string",
                    "description": "Client Secret of integration"
                },
                "username": {
                    "type": "string",
                    "description": "Username of admin user"
                },
                "password": {
                    "type": "string",
                    "description": "Password of admin user"
                },
                "disable_ssl_check": {
                    "type": "boolean",
                    "description": "Disable SSL check for API requests",
                    "default": false
                }
            }
        },
        "Dump": {
            "type": "object",
            "title": "MySQL dump configuration",
            "additionalProperties": false,
            "properties": {
                "rewrite": {
                    "type": "object"
                },
                "nodata": {
                    "type": "array",
                    "items": {"type": "string"}
                },
                "ignore": {
                    "type": "array",
                    "items": {"type": "string"}
                },
                "where": {
                    "type": "object"
                }
            }
        },
        "Sync": {
            "type": "object",
            "title": "Sync Settings",
            "additionalProperties": false,
            "properties": {
                "config": {
                    "type": "array",
                    "items": {"$ref": "#/definitions/SyncConfigItem"}
                },
                "theme": {
                    "type": "array",
                    "items": {"$ref": "#/definitions/ThemeConfigItem"}
                },
                "mail_template": {
                    "type": "array",
                    "items": {"$ref": "#/definitions/MailTemplateItem"}
                },
                "entity": {
                    "type": "array",
                    "items": {"$ref": "#/definitions/EntitySyncItem"}
                }
            }
        },
        "SyncConfigItem": {
            "type": "object",
            "title": "System Config Sync",
            "additionalProperties": false,
            "properties": {
                "sales_channel": {
                    "title": "Sales Channel to apply",
                    "type": "string"
                },
                "settings": {
                    "type": "object"
                }
            },
            "required": ["settings"]
        },
        "ThemeConfigItem": {
            "type": "object",
            "title": "Theme Config Sync",
            "additionalProperties": false,
            "properties": {
                "name": {
                    "type": "string"
                },
                "settings": {
                    "type": "object"
                }
            }
        },
        "MailTemplateItem": {
            "type": "object",
            "title": "Mail Template Sync",
            "additionalProperties": false,
            "properties": {
                "id": {
                    "type": "string"
                },
                "translations": {
                    "type": "array",
                    "items": {"$ref": "#/definitions/MailTemplateItemTranslation"}
                }
            }
        },
        "MailTemplateItemTranslation": {
            "type": "object",
            "title": "Mail Template Single Translation",
            "additionalProperties": false,
            "properties": {
                "language": {
                    "type": "string"
                },
                "sender_name": {
                    "type": "string"
                },
                "subject": {
                    "type": "string"
                },
                "html": {
                    "type": "string"
                },
                "plain": {
                    "type": "string"
                },
                "custom_fields": {
                    "type": ["object", "null"]
                }
            }
        },
        "EntitySyncItem": {
            "type": "object",
            "title": "Entity Sync",
            "additionalProperties": false,
            "properties": {
                "entity": {
                    "type": "string"
                },
                "exists": {
                    "type": "array",
                    "items": {"$ref": "#/definitions/EntitySyncFilter"}
                },
                "payload": {
                    "type": "object",
                    "description": "API payload"
                }
            },
            "required": ["entity", "payload"]
        },
        "EntitySyncFilter": {
            "type": "object",
            "title": "Entity Sync Filter",
            "additionalProperties": false,
            "properties": {
                "type": {
                    "type": "string",
                    "enum": ["equals", "multi", "contains", "prefix", "suffix", "not", "range", "until", "equalsAll" ,"equalsAny"],
                    "description": "filter type"
                },
                "field": {
                    "type": "string",
                    "description": "field"
                },
                "value": {
                    "type": ["string", "integer", "array", "boolean", "null"],
                    "description": "value"
                },
                "operator": {
                    "type": "string",
                    "enum": ["AND", "OR", "XOR"]
                },
                "queries": {
                    "type": "array",
                    "items": {"$ref": "#/definitions/EntitySyncFilterInner"}
                }
            },
            "required": ["type", "field"],
            "allOf": [
                {
                    "if": {
                        "properties": {
                            "type": {
                                "const": "multi"
                            }
                        }
                    },
                    "then": {
                        "required": ["type", "queries"]
                    }
                }
            ]
        },
        "EntitySyncFilterInner": {
            "type": "object",
            "title": "Entity Sync Filter",
            "additionalProperties": false,
            "properties": {
                "type": {
                    "type": "string",
                    "enum": ["equals", "multi", "contains", "prefix", "suffix", "not", "range", "until", "equalsAll" ,"equalsAny"],
                    "description": "filter type"
                },
                "field": {
                    "type": "string",
                    "description": "field"
                },
                "value": {
                    "type": ["string", "integer", "array", "boolean", "null"],
                    "description": "value"
                },
                "operator": {
                    "type": "string",
                    "enum": ["AND", "OR", "XOR"]
                }
            },
            "required": ["type", "field"],
            "allOf": [
                {
                    "if": {
                        "properties": {
                            "type": {
                                "const": "multi"
                            }
                        }
                    },
                    "then": {
                        "required": ["type", "queries"]
                    }
                }
            ]
        }
    }
}