{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://crapwatch.invalid/schemas/plant.schema.json",
  "title": "Crapwatch AER plant row",
  "type": "object",
  "required": ["plant", "plant_raw", "plant_status", "plant_source_page", "plant_source_section", "chapter", "source_document", "source_sha256", "source_url", "pages", "compliance_table_status", "bypass_reporting_form", "bypass_reporting_form_raw", "bypass_reporting_form_status", "bypass_reporting_form_source_page", "bypass_reporting_form_source_section"],
  "properties": {
    "plant": {"type": "string", "minLength": 1},
    "plant_raw": {"type": "string", "minLength": 1},
    "plant_status": {"enum": ["OK", "FALLBACK_SOURCE_FILENAME"]},
    "plant_source_page": {"type": ["integer", "null"], "minimum": 1},
    "plant_source_section": {"type": "string", "minLength": 1},
    "chapter": {"type": ["integer", "null"], "minimum": 1},
    "source_document": {"type": "string", "pattern": "\\.pdf$"},
    "source_sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "source_url": {"type": "string", "format": "uri"},
    "pages": {"type": "integer", "minimum": 1},
    "compliance_table_status": {"enum": ["OK", "NO_DISCHARGE_TO_WATER", "SECTION_NOT_FOUND", "TABLE_NOT_PARSED"]},
    "bypass_reporting_form": {"enum": ["NONE_REPORTED", "PER_EVENT_TABLE", "COUNT_ONLY_DATES_ON_REQUEST", "NARRATIVE_ONLY", "SUMMARY_TABLE_ONLY", "SECTION_NOT_FOUND"]},
    "bypass_reporting_form_raw": {"type": "string"},
    "bypass_reporting_form_status": {"enum": ["DERIVED_FROM_SECTION", "SECTION_NOT_FOUND"]},
    "bypass_reporting_form_source_page": {"type": ["integer", "null"], "minimum": 1},
    "bypass_reporting_form_source_section": {"const": "Bypass events"}
  },
  "additionalProperties": true
}
