/**
 * ⚠️ WARNING: THIS FILE IS AUTO-GENERATED ⚠️
 * 
 * This file is generated by the type generation system.
 * Any manual changes will be overwritten on next server start and should always be committed.
 * 
 */

import { Type } from "@sinclair/typebox"

export const CompositionSchema = {
  $id: "#composition/base",
  title: "core/composition",
  type: "object",
  required: [
    "_id",
    "title",
    "tags",
    "pathname",
    "status",
    "widgetsLayout",
    "author",
    "lastEditor",
    "createdAt",
    "updatedAt",
    "isDeleted",
  ],
  properties: {
    _id: {
      type: "string",
    },
    title: {
      minLength: 1,
      maxLength: 200,
      type: "string",
    },
    description: {
      type: "string",
    },
    tags: {
      default: [],
      type: "array",
      items: {
        type: "string",
      },
    },
    icon: {
      type: "string",
    },
    pathname: {
      default: {},
      type: "object",
      patternProperties: {
        "^(.*)$": {
          type: "string",
        },
      },
    },
    slotLayout: {
      type: "string",
    },
    status: {
      default: "inProgress",
      anyOf: [
        {
          const: "live",
          type: "string",
        },
        {
          const: "test",
          type: "string",
        },
        {
          const: "inProgress",
          type: "string",
        },
      ],
    },
    widgetsLayout: {
      default: [],
      type: "array",
      items: {
        type: "array",
        items: {
          type: "object",
          required: [
            "column",
            "widget",
          ],
          properties: {
            column: {
              type: "number",
            },
            widget: {
              type: "object",
              required: [
                "uuid",
                "name",
                "pluginKey",
              ],
              properties: {
                uuid: {
                  type: "string",
                },
                name: {
                  type: "string",
                },
                pluginKey: {
                  type: "string",
                },
                config: {},
                public: {},
              },
            },
          },
        },
      },
    },
    author: {
      type: "string",
    },
    lastEditor: {
      type: "string",
    },
    createdAt: {
      format: "date-time",
      type: "string",
    },
    updatedAt: {
      format: "date-time",
      type: "string",
    },
    isDeleted: {
      default: false,
      type: "boolean",
    },
  },
}



export default CompositionSchema
