{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/scispot/main/json-schema/scispot-labsheet-schema.json",
  "title": "Scispot Labsheet",
  "description": "A Scispot Labsheet is a structured LIMS data table used for sample registries, assay results, inventory tracking, and any structured lab data",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique labsheet identifier",
      "examples": ["ls_01HXKP7QWERTY123"]
    },
    "name": {
      "type": "string",
      "description": "Display name of the labsheet",
      "examples": ["Sample Registry", "Assay Results", "Inventory"]
    },
    "description": {
      "type": "string",
      "description": "Purpose and usage description of the labsheet"
    },
    "columns": {
      "type": "array",
      "description": "Column definitions for the labsheet schema",
      "items": {
        "$ref": "#/$defs/LabsheetColumn"
      }
    },
    "rowCount": {
      "type": "integer",
      "description": "Total number of rows in the labsheet",
      "minimum": 0
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp when the labsheet was created"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp of the last modification"
    }
  },
  "required": ["id", "name", "columns"],
  "$defs": {
    "LabsheetColumn": {
      "type": "object",
      "description": "Definition of a single column in a Scispot labsheet",
      "properties": {
        "name": {
          "type": "string",
          "description": "Column display name"
        },
        "type": {
          "type": "string",
          "enum": ["text", "number", "date", "barcode", "lookup", "file", "formula"],
          "description": "Column data type"
        },
        "required": {
          "type": "boolean",
          "description": "Whether a value is required for this column",
          "default": false
        }
      },
      "required": ["name", "type"]
    }
  }
}
