{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "https://schemas.acrobits.net/core/requests/asset.json",
    "$ref": "#/$defs/platformSplit",
    "$defs": {
        "fitMode": {
            "type": "string",
            "enum": [
                "fill",
                "contain",
                "cover"
            ]
        },
        "base64Bytes": {
            "type": "string",
            "pattern": "^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$"
        },
        "subImageRef": {
            "type": "object",
            "properties": {
                "x": {
                    "type": "integer",
                    "minimum": 0
                },
                "y": {
                    "type": "integer",
                    "minimum": 0
                },
                "width": {
                    "type": "integer",
                    "minimum": 1
                },
                "height": {
                    "type": "integer",
                    "minimum": 1
                }
            },
            "required": [
                "x",
                "y",
                "width",
                "height"
            ],
            "additionalProperties": false
        },
        "imageType": {
            "type": "string",
            "enum": [
                "png",
                "jpeg",
                "svg"
            ]
        },
        "bytesWithType": {
            "type": "object",
            "properties": {
                "bytes": {
                    "$ref": "#/$defs/base64Bytes"
                },
                "type": {
                    "$ref": "#/$defs/imageType"
                }
            },
            "required": [
                "bytes",
                "type"
            ],
            "additionalProperties": false
        },
        "bundledAsset": {
            "type": "object",
            "properties": {
                "asset": {
                    "$ref": "https://schemas.acrobits.net/core/ids/asset.json"
                },
                "fit": {
                    "$ref": "#/$defs/fitMode"
                },
                "subImage": {
                    "$ref": "#/$defs/subImageRef"
                },
                "background": {
                    "$ref": "https://schemas.acrobits.net/core/requests/color.json"
                },
                "tint": {
                    "$ref": "https://schemas.acrobits.net/core/requests/color.json"
                }
            },
            "required": [
                "asset"
            ],
            "additionalProperties": false
        },
        "urlAsset": {
            "type": "object",
            "properties": {
                "url": {
                    "type": "string",
                    "format": "uri"
                },
                "fit": {
                    "$ref": "#/$defs/fitMode"
                },
                "subImage": {
                    "$ref": "#/$defs/subImageRef"
                },
                "background": {
                    "$ref": "https://schemas.acrobits.net/core/requests/color.json"
                },
                "tint": {
                    "$ref": "https://schemas.acrobits.net/core/requests/color.json"
                }
            },
            "required": [
                "url"
            ],
            "additionalProperties": false
        },
        "base64Asset": {
            "type": "object",
            "properties": {
                "base64": {
                    "$ref": "#/$defs/bytesWithType"
                },
                "fit": {
                    "$ref": "#/$defs/fitMode"
                },
                "subImage": {
                    "$ref": "#/$defs/subImageRef"
                },
                "background": {
                    "$ref": "https://schemas.acrobits.net/core/requests/color.json"
                },
                "tint": {
                    "$ref": "https://schemas.acrobits.net/core/requests/color.json"
                }
            },
            "required": [
                "base64"
            ],
            "additionalProperties": false
        },
        "colorAsset": {
            "type": "object",
            "properties": {
                "color": {
                    "$ref": "https://schemas.acrobits.net/core/requests/color.json"
                }
            },
            "required": [
                "color"
            ],
            "additionalProperties": false
        },
        "assetSplit": {
            "oneOf": [
                {
                    "$ref": "https://schemas.acrobits.net/core/ids/asset.json"
                },
                {
                    "$ref": "#/$defs/bundledAsset"
                },
                {
                    "$ref": "#/$defs/urlAsset"
                },
                {
                    "$ref": "#/$defs/base64Asset"
                },
                {
                    "$ref": "#/$defs/colorAsset"
                }
            ]
        },
        "themeSplit": {
            "oneOf": [
                {
                    "$ref": "#/$defs/assetSplit"
                },
                {
                    "type": "object",
                    "properties": {
                        "light": {
                            "$ref": "#/$defs/assetSplit"
                        },
                        "dark": {
                            "$ref": "#/$defs/assetSplit"
                        }
                    },
                    "required": [
                        "light",
                        "dark"
                    ],
                    "additionalProperties": false
                }
            ]
        },
        "platformSplit": {
            "oneOf": [
                {
                    "$ref": "#/$defs/themeSplit"
                },
                {
                    "type": "object",
                    "properties": {
                        "desktop": {
                            "$ref": "#/$defs/themeSplit"
                        },
                        "mac": {
                            "$ref": "#/$defs/themeSplit"
                        },
                        "win": {
                            "$ref": "#/$defs/themeSplit"
                        },
                        "mobile": {
                            "$ref": "#/$defs/themeSplit"
                        },
                        "android": {
                            "$ref": "#/$defs/themeSplit"
                        },
                        "ios": {
                            "$ref": "#/$defs/themeSplit"
                        },
                        "shared": {
                            "$ref": "#/$defs/themeSplit"
                        }
                    },
                    "minProperties": 1,
                    "additionalProperties": false
                }
            ]
        }
    }
}