{
  "$schema": "mantara.schema.v1",
  "system_name": "Stage Management System",
  "schema_name": "ai_sch_20260513_072655",
  "description": "A comprehensive system for managing theater and stage operations, including productions, bookings, resources, and staff coordination.",
  "menus": [
    {
      "menu_id": 1,
      "menu_name": "User Management",
      "sequence_number": 1,
      "description": "Manage user accounts, roles, and permissions.",
      "submenus": [
        {
          "submenu_id": 101,
          "submenu_name": "User Accounts",
          "sequence_number": 1,
          "description": "Manage user registration, authentication, and profiles.",
          "tables": [
            {
              "table_name": "users",
              "comment": "Stores user account details and authentication information.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 101 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "email",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL UNIQUE"
                },
                {
                  "name": "password_hash",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL",
                  "comment": "Stores bcrypt hash, never plain text"
                },
                {
                  "name": "first_name",
                  "type": "VARCHAR(100)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "last_name",
                  "type": "VARCHAR(100)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "phone",
                  "type": "VARCHAR(50)"
                },
                {
                  "name": "role",
                  "type": "VARCHAR(50)",
                  "constraints": "NOT NULL CHECK (role IN ('administrator','venue_manager','production_manager','technical_director','staff_member','performer','guest'))"
                },
                {
                  "name": "is_active",
                  "type": "BOOLEAN",
                  "constraints": "NOT NULL DEFAULT true"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ]
            }
          ]
        },
        {
          "submenu_id": 102,
          "submenu_name": "Role Management",
          "sequence_number": 2,
          "description": "Manage user roles and permissions.",
          "tables": [
            {
              "table_name": "user_roles",
              "comment": "Associates users with roles for access control.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 102 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "user_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.users(id) ON DELETE CASCADE"
                },
                {
                  "name": "role",
                  "type": "VARCHAR(50)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "user_id",
                  "references": "sms.users(id)",
                  "on_delete": "CASCADE"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "menu_id": 2,
      "menu_name": "Venue Management",
      "sequence_number": 2,
      "description": "Manage venues, stages, and associated resources.",
      "submenus": [
        {
          "submenu_id": 201,
          "submenu_name": "Venues",
          "sequence_number": 1,
          "description": "Manage venue details and configurations.",
          "tables": [
            {
              "table_name": "venues",
              "comment": "Stores information about venues including address and capacity.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 201 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "name",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "address_line1",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "address_line2",
                  "type": "VARCHAR(255)"
                },
                {
                  "name": "city",
                  "type": "VARCHAR(100)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "state",
                  "type": "VARCHAR(100)"
                },
                {
                  "name": "postal_code",
                  "type": "VARCHAR(20)"
                },
                {
                  "name": "country",
                  "type": "VARCHAR(100)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "phone",
                  "type": "VARCHAR(50)"
                },
                {
                  "name": "email",
                  "type": "VARCHAR(255)"
                },
                {
                  "name": "website",
                  "type": "VARCHAR(255)"
                },
                {
                  "name": "description",
                  "type": "TEXT"
                },
                {
                  "name": "capacity",
                  "type": "INTEGER"
                },
                {
                  "name": "is_active",
                  "type": "BOOLEAN",
                  "constraints": "NOT NULL DEFAULT true"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ]
            }
          ]
        },
        {
          "submenu_id": 202,
          "submenu_name": "Stages",
          "sequence_number": 2,
          "description": "Manage stages within venues.",
          "tables": [
            {
              "table_name": "stages",
              "comment": "Stores details about stages within venues, including dimensions and type.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 202 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "venue_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.venues(id) ON DELETE CASCADE"
                },
                {
                  "name": "name",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "description",
                  "type": "TEXT"
                },
                {
                  "name": "capacity",
                  "type": "INTEGER"
                },
                {
                  "name": "width_feet",
                  "type": "DECIMAL(10,2)",
                  "comment": "Width in feet"
                },
                {
                  "name": "depth_feet",
                  "type": "DECIMAL(10,2)",
                  "comment": "Depth in feet"
                },
                {
                  "name": "height_feet",
                  "type": "DECIMAL(10,2)",
                  "comment": "Height in feet"
                },
                {
                  "name": "stage_type",
                  "type": "VARCHAR(50)",
                  "constraints": "CHECK (stage_type IN ('proscenium','thrust','arena','black_box','flexible','outdoor','other'))"
                },
                {
                  "name": "is_active",
                  "type": "BOOLEAN",
                  "constraints": "NOT NULL DEFAULT true"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "venue_id",
                  "references": "sms.venues(id)",
                  "on_delete": "CASCADE"
                }
              ]
            }
          ]
        },
        {
          "submenu_id": 203,
          "submenu_name": "Venue Resources",
          "sequence_number": 3,
          "description": "Manage resources available at venues.",
          "tables": [
            {
              "table_name": "resources",
              "comment": "Stores information about resources available at venues, including their category and condition.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 203 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "venue_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.venues(id) ON DELETE CASCADE"
                },
                {
                  "name": "category_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.resource_categories(id) ON DELETE RESTRICT"
                },
                {
                  "name": "name",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "description",
                  "type": "TEXT"
                },
                {
                  "name": "serial_number",
                  "type": "VARCHAR(100)"
                },
                {
                  "name": "purchase_date",
                  "type": "DATE"
                },
                {
                  "name": "purchase_price",
                  "type": "DECIMAL(10,2)",
                  "comment": "Purchase price in currency"
                },
                {
                  "name": "condition",
                  "type": "VARCHAR(50)",
                  "constraints": "CHECK (condition IN ('excellent','good','fair','poor','needs_repair','retired'))"
                },
                {
                  "name": "location",
                  "type": "VARCHAR(255)"
                },
                {
                  "name": "is_available",
                  "type": "BOOLEAN",
                  "constraints": "NOT NULL DEFAULT true"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "venue_id",
                  "references": "sms.venues(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "category_id",
                  "references": "sms.resource_categories(id)",
                  "on_delete": "RESTRICT"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "menu_id": 3,
      "menu_name": "Production Management",
      "sequence_number": 3,
      "description": "Manage productions, including scheduling, budgeting, and assignments.",
      "submenus": [
        {
          "submenu_id": 301,
          "submenu_name": "Productions",
          "sequence_number": 1,
          "description": "Manage production details and lifecycle.",
          "tables": [
            {
              "table_name": "productions",
              "comment": "Stores information about productions, including venue, dates, and status.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 301 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "venue_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.venues(id) ON DELETE CASCADE"
                },
                {
                  "name": "title",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "description",
                  "type": "TEXT"
                },
                {
                  "name": "production_type",
                  "type": "VARCHAR(50)",
                  "constraints": "CHECK (production_type IN ('play','musical','opera','dance','concert','comedy','other'))"
                },
                {
                  "name": "director",
                  "type": "VARCHAR(255)"
                },
                {
                  "name": "playwright",
                  "type": "VARCHAR(255)"
                },
                {
                  "name": "composer",
                  "type": "VARCHAR(255)"
                },
                {
                  "name": "start_date",
                  "type": "DATE"
                },
                {
                  "name": "end_date",
                  "type": "DATE"
                },
                {
                  "name": "status",
                  "type": "VARCHAR(50)",
                  "constraints": "NOT NULL CHECK (status IN ('planning','in_rehearsal','in_production','completed','cancelled'))"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "venue_id",
                  "references": "sms.venues(id)",
                  "on_delete": "CASCADE"
                }
              ]
            }
          ]
        },
        {
          "submenu_id": 302,
          "submenu_name": "Performances",
          "sequence_number": 2,
          "description": "Manage scheduled performances for productions.",
          "tables": [
            {
              "table_name": "performances",
              "comment": "Stores details about performances, including date, time, and stage.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 302 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "production_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.productions(id) ON DELETE CASCADE"
                },
                {
                  "name": "stage_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.stages(id) ON DELETE RESTRICT"
                },
                {
                  "name": "performance_date",
                  "type": "DATE",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "start_time",
                  "type": "TIME",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "end_time",
                  "type": "TIME"
                },
                {
                  "name": "doors_open_time",
                  "type": "TIME"
                },
                {
                  "name": "status",
                  "type": "VARCHAR(50)",
                  "constraints": "NOT NULL CHECK (status IN ('scheduled','cancelled','completed','in_progress'))"
                },
                {
                  "name": "notes",
                  "type": "TEXT"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "production_id",
                  "references": "sms.productions(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "stage_id",
                  "references": "sms.stages(id)",
                  "on_delete": "RESTRICT"
                }
              ]
            }
          ]
        },
        {
          "submenu_id": 303,
          "submenu_name": "Rehearsals",
          "sequence_number": 3,
          "description": "Manage rehearsal schedules and details.",
          "tables": [
            {
              "table_name": "rehearsals",
              "comment": "Stores information about rehearsals, including date, time, and location.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 303 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "production_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.productions(id) ON DELETE CASCADE"
                },
                {
                  "name": "stage_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.stages(id) ON DELETE SET NULL"
                },
                {
                  "name": "rehearsal_date",
                  "type": "DATE",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "start_time",
                  "type": "TIME",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "end_time",
                  "type": "TIME",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "rehearsal_type",
                  "type": "VARCHAR(50)",
                  "constraints": "CHECK (rehearsal_type IN ('read_through','blocking','working','technical','dress','other'))"
                },
                {
                  "name": "location",
                  "type": "VARCHAR(255)"
                },
                {
                  "name": "notes",
                  "type": "TEXT"
                },
                {
                  "name": "status",
                  "type": "VARCHAR(50)",
                  "constraints": "NOT NULL CHECK (status IN ('scheduled','cancelled','completed'))"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "production_id",
                  "references": "sms.productions(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "stage_id",
                  "references": "sms.stages(id)",
                  "on_delete": "SET NULL"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "menu_id": 4,
      "menu_name": "Resource Management",
      "sequence_number": 4,
      "description": "Manage resources, including assignments and maintenance.",
      "submenus": [
        {
          "submenu_id": 401,
          "submenu_name": "Resource Categories",
          "sequence_number": 1,
          "description": "Manage categories for organizing resources.",
          "tables": [
            {
              "table_name": "resource_categories",
              "comment": "Stores categories for resources, allowing hierarchical organization.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 401 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "name",
                  "type": "VARCHAR(100)",
                  "constraints": "NOT NULL UNIQUE"
                },
                {
                  "name": "description",
                  "type": "TEXT"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ]
            }
          ]
        },
        {
          "submenu_id": 402,
          "submenu_name": "Resource Assignments",
          "sequence_number": 2,
          "description": "Manage assignments of resources to productions.",
          "tables": [
            {
              "table_name": "resource_assignments",
              "comment": "Tracks assignments of resources to productions, including dates and quantities.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 402 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "resource_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.resources(id) ON DELETE CASCADE"
                },
                {
                  "name": "production_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.productions(id) ON DELETE CASCADE"
                },
                {
                  "name": "assigned_date",
                  "type": "DATE",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "return_date",
                  "type": "DATE"
                },
                {
                  "name": "quantity",
                  "type": "INTEGER",
                  "constraints": "NOT NULL DEFAULT 1"
                },
                {
                  "name": "notes",
                  "type": "TEXT"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "resource_id",
                  "references": "sms.resources(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "production_id",
                  "references": "sms.productions(id)",
                  "on_delete": "CASCADE"
                }
              ]
            }
          ]
        },
        {
          "submenu_id": 403,
          "submenu_name": "Maintenance Records",
          "sequence_number": 3,
          "description": "Track maintenance activities for resources.",
          "tables": [
            {
              "table_name": "maintenance_records",
              "comment": "Documents maintenance activities for resources, including costs and dates.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 403 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "resource_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.resources(id) ON DELETE CASCADE"
                },
                {
                  "name": "performed_by_user_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.users(id) ON DELETE SET NULL"
                },
                {
                  "name": "maintenance_type",
                  "type": "VARCHAR(50)",
                  "constraints": "NOT NULL CHECK (maintenance_type IN ('inspection','repair','cleaning','calibration','replacement','other'))"
                },
                {
                  "name": "description",
                  "type": "TEXT",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "maintenance_date",
                  "type": "DATE",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "cost",
                  "type": "DECIMAL(10,2)",
                  "comment": "Cost of maintenance in currency"
                },
                {
                  "name": "next_maintenance_date",
                  "type": "DATE"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "resource_id",
                  "references": "sms.resources(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "performed_by_user_id",
                  "references": "sms.users(id)",
                  "on_delete": "SET NULL"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "menu_id": 5,
      "menu_name": "Scheduling and Bookings",
      "sequence_number": 5,
      "description": "Manage scheduling of rehearsals, performances, and venue bookings.",
      "submenus": [
        {
          "submenu_id": 501,
          "submenu_name": "Bookings",
          "sequence_number": 1,
          "description": "Manage booking requests and confirmations for venues.",
          "tables": [
            {
              "table_name": "bookings",
              "comment": "Stores booking requests and confirmations for venue spaces.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 501 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "venue_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.venues(id) ON DELETE CASCADE"
                },
                {
                  "name": "requester_name",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "requester_email",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "requester_phone",
                  "type": "VARCHAR(50)"
                },
                {
                  "name": "event_name",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "event_description",
                  "type": "TEXT"
                },
                {
                  "name": "start_date",
                  "type": "DATE",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "end_date",
                  "type": "DATE",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "status",
                  "type": "VARCHAR(50)",
                  "constraints": "NOT NULL CHECK (status IN ('inquiry','pending','approved','rejected','cancelled','completed'))"
                },
                {
                  "name": "notes",
                  "type": "TEXT"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "venue_id",
                  "references": "sms.venues(id)",
                  "on_delete": "CASCADE"
                }
              ]
            }
          ]
        },
        {
          "submenu_id": 502,
          "submenu_name": "Schedules",
          "sequence_number": 2,
          "description": "Manage schedules for rehearsals, performances, and other events.",
          "tables": [
            {
              "table_name": "schedules",
              "comment": "Stores schedules for various events, including rehearsals and performances.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 502 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "user_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.users(id) ON DELETE CASCADE"
                },
                {
                  "name": "production_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.productions(id) ON DELETE CASCADE"
                },
                {
                  "name": "venue_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.venues(id) ON DELETE CASCADE"
                },
                {
                  "name": "title",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "description",
                  "type": "TEXT"
                },
                {
                  "name": "schedule_type",
                  "type": "VARCHAR(50)",
                  "constraints": "NOT NULL CHECK (schedule_type IN ('rehearsal','performance','meeting','call_time','other'))"
                },
                {
                  "name": "start_datetime",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "end_datetime",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "location",
                  "type": "VARCHAR(255)"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "user_id",
                  "references": "sms.users(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "production_id",
                  "references": "sms.productions(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "venue_id",
                  "references": "sms.venues(id)",
                  "on_delete": "CASCADE"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "menu_id": 6,
      "menu_name": "Budget and Financial Management",
      "sequence_number": 6,
      "description": "Manage budgets and expenses for productions.",
      "submenus": [
        {
          "submenu_id": 601,
          "submenu_name": "Budgets",
          "sequence_number": 1,
          "description": "Manage production budgets and financial planning.",
          "tables": [
            {
              "table_name": "budgets",
              "comment": "Stores budget information for productions, including total amounts and notes.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 601 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "production_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.productions(id) ON DELETE CASCADE"
                },
                {
                  "name": "total_budget",
                  "type": "DECIMAL(12,2)",
                  "constraints": "NOT NULL",
                  "comment": "Total budget in currency"
                },
                {
                  "name": "notes",
                  "type": "TEXT"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "production_id",
                  "references": "sms.productions(id)",
                  "on_delete": "CASCADE"
                }
              ]
            }
          ]
        },
        {
          "submenu_id": 602,
          "submenu_name": "Expenses",
          "sequence_number": 2,
          "description": "Track expenses against production budgets.",
          "tables": [
            {
              "table_name": "expenses",
              "comment": "Records expenses related to productions, including amounts and categories.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 602 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "budget_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.budgets(id) ON DELETE CASCADE"
                },
                {
                  "name": "production_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.productions(id) ON DELETE CASCADE"
                },
                {
                  "name": "venue_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.venues(id) ON DELETE CASCADE"
                },
                {
                  "name": "category",
                  "type": "VARCHAR(100)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "description",
                  "type": "TEXT",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "amount",
                  "type": "DECIMAL(10,2)",
                  "constraints": "NOT NULL",
                  "comment": "Expense amount in currency"
                },
                {
                  "name": "expense_date",
                  "type": "DATE",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "vendor",
                  "type": "VARCHAR(255)"
                },
                {
                  "name": "receipt_url",
                  "type": "VARCHAR(500)"
                },
                {
                  "name": "status",
                  "type": "VARCHAR(50)",
                  "constraints": "NOT NULL CHECK (status IN ('pending','approved','rejected','paid'))"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "budget_id",
                  "references": "sms.budgets(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "production_id",
                  "references": "sms.productions(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "venue_id",
                  "references": "sms.venues(id)",
                  "on_delete": "CASCADE"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "menu_id": 7,
      "menu_name": "Task and Assignment Management",
      "sequence_number": 7,
      "description": "Manage tasks and assignments for users and productions.",
      "submenus": [
        {
          "submenu_id": 701,
          "submenu_name": "Tasks",
          "sequence_number": 1,
          "description": "Manage tasks assigned to users and linked to productions.",
          "tables": [
            {
              "table_name": "tasks",
              "comment": "Stores tasks assigned to users, including status and priority.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 701 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "assigned_to_user_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.users(id) ON DELETE SET NULL"
                },
                {
                  "name": "created_by_user_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.users(id) ON DELETE CASCADE"
                },
                {
                  "name": "production_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.productions(id) ON DELETE CASCADE"
                },
                {
                  "name": "venue_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.venues(id) ON DELETE CASCADE"
                },
                {
                  "name": "title",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "description",
                  "type": "TEXT"
                },
                {
                  "name": "priority",
                  "type": "VARCHAR(50)",
                  "constraints": "NOT NULL CHECK (priority IN ('low','medium','high','urgent'))"
                },
                {
                  "name": "status",
                  "type": "VARCHAR(50)",
                  "constraints": "NOT NULL CHECK (status IN ('todo','in_progress','blocked','completed','cancelled'))"
                },
                {
                  "name": "due_date",
                  "type": "DATE"
                },
                {
                  "name": "completed_at",
                  "type": "TIMESTAMP"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "assigned_to_user_id",
                  "references": "sms.users(id)",
                  "on_delete": "SET NULL"
                },
                {
                  "column": "created_by_user_id",
                  "references": "sms.users(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "production_id",
                  "references": "sms.productions(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "venue_id",
                  "references": "sms.venues(id)",
                  "on_delete": "CASCADE"
                }
              ]
            }
          ]
        },
        {
          "submenu_id": 702,
          "submenu_name": "Staff Assignments",
          "sequence_number": 2,
          "description": "Manage staff assignments to productions and venues.",
          "tables": [
            {
              "table_name": "staff_assignments",
              "comment": "Tracks staff assignments to productions and venues, including roles and dates.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 702 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "user_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.users(id) ON DELETE CASCADE"
                },
                {
                  "name": "production_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.productions(id) ON DELETE CASCADE"
                },
                {
                  "name": "venue_id",
                  "type": "UUID",
                  "constraints": "REFERENCES sms.venues(id) ON DELETE CASCADE"
                },
                {
                  "name": "role",
                  "type": "VARCHAR(100)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "start_date",
                  "type": "DATE",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "end_date",
                  "type": "DATE"
                },
                {
                  "name": "notes",
                  "type": "TEXT"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "user_id",
                  "references": "sms.users(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "production_id",
                  "references": "sms.productions(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "venue_id",
                  "references": "sms.venues(id)",
                  "on_delete": "CASCADE"
                }
              ]
            }
          ]
        },
        {
          "submenu_id": 703,
          "submenu_name": "Cast Assignments",
          "sequence_number": 3,
          "description": "Manage cast assignments to roles within productions.",
          "tables": [
            {
              "table_name": "cast_assignments",
              "comment": "Tracks cast assignments to roles in productions, including role type and notes.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 703 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "user_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.users(id) ON DELETE CASCADE"
                },
                {
                  "name": "production_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.productions(id) ON DELETE CASCADE"
                },
                {
                  "name": "role_name",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "role_type",
                  "type": "VARCHAR(50)",
                  "constraints": "CHECK (role_type IN ('lead','supporting','ensemble','understudy','other'))"
                },
                {
                  "name": "notes",
                  "type": "TEXT"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "user_id",
                  "references": "sms.users(id)",
                  "on_delete": "CASCADE"
                },
                {
                  "column": "production_id",
                  "references": "sms.productions(id)",
                  "on_delete": "CASCADE"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "menu_id": 8,
      "menu_name": "Communication and Notifications",
      "sequence_number": 8,
      "description": "Manage notifications and communication between users.",
      "submenus": [
        {
          "submenu_id": 801,
          "submenu_name": "Notifications",
          "sequence_number": 1,
          "description": "Manage system-generated notifications for users.",
          "tables": [
            {
              "table_name": "notifications",
              "comment": "Stores notifications sent to users, including type and read status.",
              "columns": [
                {
                  "name": "id",
                  "type": "UUID",
                  "constraints": "PRIMARY KEY DEFAULT gen_random_uuid()"
                },
                {
                  "name": "submenu_id",
                  "type": "INT",
                  "constraints": "DEFAULT 801 NOT NULL REFERENCES sms.submenu(submenu_id)"
                },
                {
                  "name": "user_id",
                  "type": "UUID",
                  "constraints": "NOT NULL REFERENCES sms.users(id) ON DELETE CASCADE"
                },
                {
                  "name": "title",
                  "type": "VARCHAR(255)",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "message",
                  "type": "TEXT",
                  "constraints": "NOT NULL"
                },
                {
                  "name": "notification_type",
                  "type": "VARCHAR(50)",
                  "constraints": "NOT NULL CHECK (notification_type IN ('info','warning','alert','reminder','message'))"
                },
                {
                  "name": "is_read",
                  "type": "BOOLEAN",
                  "constraints": "NOT NULL DEFAULT false"
                },
                {
                  "name": "read_at",
                  "type": "TIMESTAMP"
                },
                {
                  "name": "related_entity_type",
                  "type": "VARCHAR(50)"
                },
                {
                  "name": "related_entity_id",
                  "type": "UUID"
                },
                {
                  "name": "created_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                },
                {
                  "name": "updated_at",
                  "type": "TIMESTAMP",
                  "constraints": "NOT NULL DEFAULT CURRENT_TIMESTAMP"
                }
              ],
              "foreign_keys": [
                {
                  "column": "user_id",
                  "references": "sms.users(id)",
                  "on_delete": "CASCADE"
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "assumptions": [
    "Each venue can have multiple stages with different configurations.",
    "Productions can have multiple performances and rehearsals.",
    "Resources are categorized and can be assigned to productions."
  ],
  "open_questions": [
    "Should the system support multi-currency budgeting?",
    "Is there a need for role-based access beyond the predefined roles?"
  ]
}
