{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://json.schemastore.org/aurora-1.3.json",
  "$comment": "https://docs.aurorajs.dev/",
  "additionalProperties": false,
  "definitions": {
    "propertyDefinition": {
      "type": "object",
      "required": ["name", "type"],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of property, in camelCase",
          "minLength": 2
        },
        "description": {
          "type": "string",
          "description": "The description of the property",
          "minLength": 2
        },
        "type": {
          "type": "string",
          "description": "The type of property",
          "examples": ["varchar"],
          "enum": [
            "array",
            "bigint",
            "blob.long",
            "blob.medium",
            "blob.tiny",
            "blob",
            "boolean",
            "char",
            "date",
            "decimal",
            "encrypted",
            "enum",
            "float",
            "id",
            "int",
            "json",
            "jsonb",
            "manyToMany",
            "password",
            "relationship",
            "smallint",
            "text",
            "timestamp",
            "varchar"
          ]
        },
        "arrayOptions": {
          "type": "object",
          "description": "Options to define array property",
          "required": ["type"],
          "properties": {
            "type": {
              "type": "string",
              "description": "The type of property",
              "enum": [
                "char",
                "date",
                "decimal",
                "enum",
                "id",
                "int",
                "timestamp",
                "varchar"
              ]
            },
            "length": {
              "type": "number",
              "description": "Set max length to property",
              "minimum": 1
            },
            "maxLength": {
              "type": "number",
              "description": "Set max length to property",
              "minimum": 1
            },
            "enumOptions": {
              "type": "array",
              "description": "Values for enum type",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        "length": {
          "type": "number",
          "description": "Set max length to property",
          "minimum": 1
        },
        "maxLength": {
          "type": "number",
          "description": "Set max length to property",
          "minimum": 1
        },
        "nullable": {
          "type": "boolean",
          "description": "Set property to nullable"
        },
        "unsigned": {
          "type": "boolean",
          "description": "Set property like unsigned"
        },
        "primaryKey": {
          "type": "boolean",
          "description": "Set property to primary key"
        },
        "index": {
          "type": "string",
          "description": "To define property like a index",
          "enum": ["index", "unique"]
        },
        "indexFields": {
          "type": "array",
          "description": "Fields to do composite unique index",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "indexName": {
          "type": "string",
          "description": "The name of index, if there are various indexes with the same name, they will be grouped",
          "minLength": 2
        },
        "indexUsing": {
          "type": "string",
          "description": "To define property like a index",
          "enum": ["Btree", "GIN", "HASH", "spgist", "GiST", "BRIN"]
        },
        "isI18n": {
          "type": "boolean",
          "description": "Set property as i18n, this property will be used to translate the entity in the translation table"
        },
        "enumOptions": {
          "type": "array",
          "description": "Values for enum type",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "defaultValue": {
          "oneOf": [
            { "type": "string" },
            { "type": "number" },
            { "type": "boolean" }
          ],
          "description": "Default value for property"
        },
        "example": {
          "type": ["number", "string", "boolean", "array"],
          "description": "Example value for property, this value will be used in swagger documentation"
        },
        "decimals": {
          "type": "array",
          "description": "Total digits of the number and length of the decimal places in the back of the number, example: [10, 2].",
          "items": {
            "type": "number",
            "minimum": 1
          }
        },
        "autoIncrement": {
          "type": "boolean",
          "description": "Set number property as auto increment"
        },
        "applyTimezone": {
          "type": "boolean",
          "description": "Apply timezone to date property, by default is true"
        },
        "relationship": {
          "$ref": "#/definitions/relationshipDefinition"
        },
        "webComponent": {
          "$ref": "#/definitions/webComponentDefinition"
        }
      }
    },
    "additionalApisDefinition": {
      "type": "object",
      "required": ["path", "resolverType", "httpMethod"],
      "properties": {
        "path": {
          "type": "string",
          "description": "Path to access api",
          "minLength": 2,
          "examples": [
            "auditing/side-effect/rollback",
            "iam/account/check-unique-username"
          ]
        },
        "resolverType": {
          "type": "string",
          "description": "Type of resolver, query or mutation",
          "enum": ["query", "mutation"],
          "examples": ["query"]
        },
        "httpMethod": {
          "type": "string",
          "description": "Verb of api rest",
          "enum": ["get", "post", "put", "delete", "patch"],
          "examples": ["post"]
        }
      }
    },
    "relationshipDefinition": {
      "type": "object",
      "additionalProperties": false,
      "description": "Relationship definition for this property",
      "properties": {
        "type": {
          "type": "string",
          "description": "The type of web component",
          "enum": [
            "many-to-many",
            "many-to-one",
            "none",
            "one-to-many",
            "one-to-one"
          ]
        },
        "singularName": {
          "type": "string",
          "description": "Singular name of the property referred to in the relationship, only for one-to-many and many-to-many relationship, example: book",
          "minLength": 2
        },
        "aggregateName": {
          "type": "string",
          "description": "Aggregate referring to this relationship, example: LibraryAuthor",
          "minLength": 2
        },
        "modulePath": {
          "type": "string",
          "description": "Path to the module that refers to this relationship, example: library/author",
          "minLength": 2
        },
        "key": {
          "type": "string",
          "description": "Property key that refers to this relationship, only for many-to-one relationship, example: id",
          "minLength": 2
        },
        "field": {
          "type": "string",
          "description": "Field to obtain the relationship data, example: author",
          "minLength": 2
        },
        "description": {
          "type": "string",
          "description": "The description of the relationship field",
          "minLength": 2
        },
        "avoidConstraint": {
          "type": "boolean",
          "description": "Avoid constraint rules for this relationship"
        },
        "packageName": {
          "type": "string",
          "description": "Path to packageName where is the relationship, example: @aurora-ts/core",
          "minLength": 2
        },
        "isDenormalized": {
          "type": "boolean",
          "description": "Set many-to-many relationship as denormalized, creating a field to store the selected ids"
        },
        "pivot": {
          "$ref": "#/definitions/pivotTableDefinition"
        }
      }
    },
    "webComponentDefinition": {
      "type": "object",
      "additionalProperties": false,
      "description": "Web Component that wil be rendered for this property",
      "properties": {
        "type": {
          "type": "string",
          "description": "The type of web component",
          "enum": [
            "async-search-multiple-select",
            "async-search-select",
            "grid-elements-manager",
            "grid-select-element",
            "grid-select-multiple-elements",
            "multiple-select",
            "search-multiple-select",
            "search-select",
            "select"
          ]
        },
        "className": {
          "type": "string",
          "description": "CSS class for web component",
          "minLength": 2
        },
        "detailSort": {
          "type": "number",
          "description": "Web component order on detail view",
          "minimum": 1
        },
        "isDetailHidden": {
          "type": "boolean",
          "description": "Set hidden web component on detail view"
        },
        "listSort": {
          "type": "number",
          "description": "Web component order on list view",
          "minimum": 1
        },
        "isListHidden": {
          "type": "boolean",
          "description": "Set hidden web component on list view"
        }
      }
    },
    "excludedOperationDefinition": {
      "type": "array",
      "description": "Operations to be excluded from the module",
      "examples": [
        ["create", "update", "delete"],
        ["create", "update", "delete", "findById"]
      ],
      "items": {
        "enum": [
          "count",
          "create",
          "createBatch",
          "deleteById",
          "delete",
          "findById",
          "find",
          "get",
          "max",
          "min",
          "paginate",
          "rawSql",
          "getRaw",
          "sum",
          "updateAndIncrement",
          "updateById",
          "update",
          "upsert"
        ]
      }
    },
    "frontDefinition": {
      "type": "object",
      "additionalProperties": false,
      "description": "Appearance properties for front application",
      "properties": {
        "outlineFontSetIcon": {
          "type": "string",
          "description": "Font set outline icon to be used in the front application",
          "minLength": 2,
          "examples": ["material-symbols-outlined"]
        },
        "outlineIcon": {
          "type": "string",
          "description": "Outline icon to be used in the front application",
          "minLength": 2,
          "examples": ["heroicons_solid:tag", "photo_auto_merge"]
        },
        "solidFontSetIcon": {
          "type": "string",
          "description": "Font set solid icon to be used in the front application",
          "minLength": 2,
          "examples": ["material-symbols-outlined"]
        },
        "solidIcon": {
          "type": "string",
          "description": "Solid icon to be used in the front application",
          "minLength": 2,
          "examples": ["heroicons_solid:tag", "photo_auto_merge"]
        }
      }
    },
    "pivotTableDefinition": {
      "type": "object",
      "additionalProperties": false,
      "description": "Relationship pivot table definition for this relationship",
      "properties": {
        "boundedContextName": {
          "type": "string",
          "description": "The name of the package, singular in kebab-case",
          "minLength": 2
        },
        "moduleName": {
          "type": "string",
          "description": "The name of the module, singular in kebab-case",
          "minLength": 2
        },
        "moduleNames": {
          "type": "string",
          "description": "The name of the module, plural in kebab-case",
          "minLength": 2
        },
        "aggregateName": {
          "type": "string",
          "description": "The name of the aggregateName, singular in PascalCase",
          "minLength": 2
        },
        "hasOAuth": {
          "type": "boolean",
          "description": "Enabled authentication for this pivot table",
          "default": false
        },
        "hasAuditing": {
          "type": "boolean",
          "description": "Enabled auditing for pivot table",
          "default": false
        },
        "aggregateProperties": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/propertyDefinition"
          }
        },
        "excludedFiles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "excludedOperations": {
          "$ref": "#/definitions/excludedOperationDefinition"
        }
      }
    }
  },
  "description": "Make agile applications without technical debt",
  "properties": {
    "version": {
      "type": "string",
      "description": "Schema version",
      "default": "0.0.1",
      "minLength": 2
    },
    "boundedContextName": {
      "type": "string",
      "description": "The name of the package, singular in kebab case",
      "examples": ["iam", "queue-manager"],
      "minLength": 2
    },
    "moduleName": {
      "type": "string",
      "description": "The name of the module, singular in kebab case",
      "examples": ["account", "job-registry"],
      "minLength": 2
    },
    "moduleNames": {
      "type": "string",
      "description": "The name of the module, plural in kebab case",
      "examples": ["accounts", "jobs-registry"],
      "minLength": 2
    },
    "aggregateName": {
      "type": "string",
      "description": "The name of the aggregateName, singular in pascal case, is composed of the boundedContextName plus the moduleName",
      "examples": ["IamAccount", "QueueManagerJobRegistry"],
      "minLength": 2
    },
    "hasOAuth": {
      "type": "boolean",
      "description": "Enabled authentication for this module",
      "examples": [false],
      "default": false
    },
    "hasTenant": {
      "type": "boolean",
      "description": "Enabled tenant for this module",
      "examples": [false],
      "default": false
    },
    "hasAuditing": {
      "type": "boolean",
      "description": "Enabled auditing for this module",
      "examples": [false],
      "default": false
    },
    "front": {
      "$ref": "#/definitions/frontDefinition"
    },
    "aggregateProperties": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/propertyDefinition"
      }
    },
    "additionalApis": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/additionalApisDefinition"
      }
    },
    "excludedFiles": {
      "type": "array",
      "description": "Files to be excluded from the module",
      "examples": [
        "src/@api/iam/account/resolvers/iam-create-accounts.resolver.ts",
        "src/@api/iam/account/resolvers/iam-create-accounts.resolver.spec.ts"
      ],
      "items": {
        "type": "string"
      }
    },
    "excludedOperations": {
      "$ref": "#/definitions/excludedOperationDefinition"
    }
  },
  "required": [
    "boundedContextName",
    "moduleName",
    "moduleNames",
    "aggregateName"
  ],
  "title": "Aurora Agile Meta Framework",
  "type": "object"
}
