mightstone.services.cardconjurer.models.Card

pydantic model mightstone.services.cardconjurer.models.Card

A Card as described in Card Conjurer JSON

Show JSON schema
{
   "title": "Card",
   "description": "A Card as described in Card Conjurer JSON",
   "type": "object",
   "properties": {
      "asset_root_url": {
         "default": "",
         "title": "Asset Root Url",
         "type": "string"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "width": {
         "title": "Width",
         "type": "integer"
      },
      "height": {
         "title": "Height",
         "type": "integer"
      },
      "corners": {
         "default": 0,
         "title": "Corners",
         "type": "integer"
      },
      "marginX": {
         "default": 0,
         "title": "Marginx",
         "type": "integer"
      },
      "marginY": {
         "default": 0,
         "title": "Marginy",
         "type": "integer"
      },
      "dependencies": {
         "allOf": [
            {
               "$ref": "#/$defs/Dependencies"
            }
         ],
         "default": {
            "extensions": [],
            "template": null
         }
      },
      "data": {
         "allOf": [
            {
               "$ref": "#/$defs/Group"
            }
         ],
         "default": {
            "type": "group",
            "name": null,
            "tags": null,
            "children": []
         }
      }
   },
   "$defs": {
      "Bound": {
         "properties": {
            "x": {
               "title": "X",
               "type": "integer"
            },
            "y": {
               "title": "Y",
               "type": "integer"
            },
            "width": {
               "title": "Width",
               "type": "integer"
            },
            "height": {
               "title": "Height",
               "type": "integer"
            },
            "type": {
               "$ref": "#/$defs/BoundType"
            },
            "horizontal": {
               "$ref": "#/$defs/HorizontalAlign"
            },
            "vertical": {
               "$ref": "#/$defs/VerticalAlign"
            }
         },
         "required": [
            "x",
            "y",
            "width",
            "height",
            "type",
            "horizontal",
            "vertical"
         ],
         "title": "Bound",
         "type": "object"
      },
      "BoundType": {
         "enum": [
            "fit",
            "fill"
         ],
         "title": "BoundType",
         "type": "string"
      },
      "Dependencies": {
         "properties": {
            "extensions": {
               "default": [],
               "items": {
                  "type": "string"
               },
               "title": "Extensions",
               "type": "array"
            },
            "template": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TemplateRef"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "Dependencies",
         "type": "object"
      },
      "FilterOverlay": {
         "properties": {
            "type": {
               "const": "colorOverlay",
               "enum": [
                  "colorOverlay"
               ],
               "title": "Type",
               "type": "string"
            },
            "color": {
               "format": "color",
               "title": "Color",
               "type": "string"
            }
         },
         "required": [
            "type",
            "color"
         ],
         "title": "FilterOverlay",
         "type": "object"
      },
      "FilterShadow": {
         "properties": {
            "type": {
               "const": "shadow",
               "enum": [
                  "shadow"
               ],
               "title": "Type",
               "type": "string"
            },
            "color": {
               "default": "black",
               "format": "color",
               "title": "Color",
               "type": "string"
            },
            "x": {
               "title": "X",
               "type": "integer"
            },
            "y": {
               "title": "Y",
               "type": "integer"
            }
         },
         "required": [
            "type",
            "x",
            "y"
         ],
         "title": "FilterShadow",
         "type": "object"
      },
      "Group": {
         "description": "A layer composed of a list of other layers (One of the 3 possible layer types)",
         "properties": {
            "type": {
               "const": "group",
               "default": "group",
               "enum": [
                  "group"
               ],
               "title": "Type",
               "type": "string"
            },
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Name"
            },
            "tags": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/Tags"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Tags"
            },
            "children": {
               "default": [],
               "items": {
                  "discriminator": {
                     "mapping": {
                        "group": "#/$defs/Group",
                        "image": "#/$defs/Image",
                        "text": "#/$defs/Text"
                     },
                     "propertyName": "type"
                  },
                  "oneOf": [
                     {
                        "$ref": "#/$defs/Group"
                     },
                     {
                        "$ref": "#/$defs/Text"
                     },
                     {
                        "$ref": "#/$defs/Image"
                     }
                  ]
               },
               "title": "Children",
               "type": "array"
            }
         },
         "title": "Group",
         "type": "object"
      },
      "HorizontalAlign": {
         "enum": [
            "left",
            "right",
            "center"
         ],
         "title": "HorizontalAlign",
         "type": "string"
      },
      "Image": {
         "description": "A layer composed of an image (One of the 3 possible layer types)",
         "properties": {
            "type": {
               "const": "image",
               "enum": [
                  "image"
               ],
               "title": "Type",
               "type": "string"
            },
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Name"
            },
            "tags": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/Tags"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Tags"
            },
            "src": {
               "title": "Src",
               "type": "string"
            },
            "x": {
               "default": 0,
               "title": "X",
               "type": "integer"
            },
            "y": {
               "default": 0,
               "title": "Y",
               "type": "integer"
            },
            "z": {
               "default": 0,
               "title": "Z",
               "type": "integer"
            },
            "width": {
               "default": 100,
               "title": "Width",
               "type": "integer"
            },
            "height": {
               "default": 100,
               "title": "Height",
               "type": "integer"
            },
            "thumb": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Thumb"
            },
            "bounds": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Bound"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "masks": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/Mask"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Masks"
            },
            "opacity": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Opacity"
            },
            "filters": {
               "anyOf": [
                  {
                     "items": {
                        "discriminator": {
                           "mapping": {
                              "colorOverlay": "#/$defs/FilterOverlay",
                              "shadow": "#/$defs/FilterShadow"
                           },
                           "propertyName": "type"
                        },
                        "oneOf": [
                           {
                              "$ref": "#/$defs/FilterShadow"
                           },
                           {
                              "$ref": "#/$defs/FilterOverlay"
                           }
                        ]
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Filters"
            }
         },
         "required": [
            "type",
            "src"
         ],
         "title": "Image",
         "type": "object"
      },
      "Mask": {
         "properties": {
            "type": {
               "const": "image",
               "enum": [
                  "image"
               ],
               "title": "Type",
               "type": "string"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "src": {
               "title": "Src",
               "type": "string"
            }
         },
         "required": [
            "type",
            "name",
            "src"
         ],
         "title": "Mask",
         "type": "object"
      },
      "Tags": {
         "description": "Another important note is that many text and image layers have the tags \"editable\",\nand there are two groups tagged \"new-image-group\" and \"new-text-group\". These tags\ntell the UI which layers should be presented as editable, and which layer groups\nshould store newly-added layers.",
         "enum": [
            "editable",
            "draggable",
            "new-image-group",
            "new-text-group",
            "name"
         ],
         "title": "Tags",
         "type": "string"
      },
      "TemplateRef": {
         "properties": {
            "url": {
               "title": "Url",
               "type": "string"
            }
         },
         "required": [
            "url"
         ],
         "title": "TemplateRef",
         "type": "object"
      },
      "Text": {
         "description": "A layer composed of a text (One of the 3 possible layer types)",
         "properties": {
            "type": {
               "const": "text",
               "enum": [
                  "text"
               ],
               "title": "Type",
               "type": "string"
            },
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Name"
            },
            "tags": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/Tags"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Tags"
            },
            "text": {
               "title": "Text",
               "type": "string"
            },
            "font": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Font"
            },
            "color": {
               "default": "white",
               "format": "color",
               "title": "Color",
               "type": "string"
            },
            "oneLine": {
               "default": false,
               "title": "Oneline",
               "type": "boolean"
            },
            "align": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/HorizontalAlign"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "left"
            },
            "verticalAlign": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VerticalAlign"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": "center"
            },
            "lineHeightScale": {
               "default": 1,
               "title": "Lineheightscale",
               "type": "number"
            },
            "fontWeight": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Fontweight"
            },
            "rotation": {
               "default": 0,
               "title": "Rotation",
               "type": "integer"
            },
            "size": {
               "title": "Size",
               "type": "integer"
            },
            "opacity": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Opacity"
            },
            "x": {
               "title": "X",
               "type": "integer"
            },
            "y": {
               "title": "Y",
               "type": "integer"
            },
            "width": {
               "title": "Width",
               "type": "integer"
            },
            "height": {
               "title": "Height",
               "type": "integer"
            },
            "textCodesOnly": {
               "default": false,
               "title": "Textcodesonly",
               "type": "boolean"
            },
            "filters": {
               "anyOf": [
                  {
                     "items": {
                        "anyOf": [
                           {
                              "$ref": "#/$defs/FilterShadow"
                           },
                           {
                              "$ref": "#/$defs/FilterOverlay"
                           }
                        ]
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Filters"
            }
         },
         "required": [
            "type",
            "text",
            "size",
            "x",
            "y",
            "width",
            "height"
         ],
         "title": "Text",
         "type": "object"
      },
      "VerticalAlign": {
         "enum": [
            "top",
            "center",
            "bottom"
         ],
         "title": "VerticalAlign",
         "type": "string"
      }
   },
   "required": [
      "name",
      "width",
      "height"
   ]
}

Fields:
field asset_root_url: str = ''

Not part of CardConjurer model This allow to re-contextualize relative path and build proper urls

field corners: int = 0
field data: Group = Group(type=<LayerTypes.GROUP: 'group'>, name=None, tags=None, children=[])
field dependencies: Dependencies = Dependencies(extensions=[], template=None)
field height: int [Required]
field marginX: int = 0
field marginY: int = 0
field name: str [Required]
field width: int [Required]
find_many_groups(**kwargs) Generator[Group, None, None]
find_many_images(**kwargs) Generator[Image | Mask, None, None]
find_many_layer(**kwargs)
find_many_text(**kwargs) Generator[Text, None, None]
find_one_layer(**kwargs)