-- Add metadata fields to classification_labels for wizard data
-- 028_add_label_metadata_fields.sql

ALTER TABLE classification_labels ADD COLUMN IF NOT EXISTS apply_to JSONB DEFAULT '[]'::jsonb;
ALTER TABLE classification_labels ADD COLUMN IF NOT EXISTS auto_apply_rules JSONB DEFAULT '{}'::jsonb;
ALTER TABLE classification_labels ADD COLUMN IF NOT EXISTS departments_access JSONB DEFAULT '{"all": true, "specific": []}'::jsonb;
ALTER TABLE classification_labels ADD COLUMN IF NOT EXISTS visual_marking JSONB DEFAULT '{}'::jsonb;

COMMENT ON COLUMN classification_labels.apply_to IS 'Where to apply label: Files & Documents, Emails, SharePoint Sites, etc.';
COMMENT ON COLUMN classification_labels.auto_apply_rules IS 'Auto-apply rules: sensitive_data_types, file_location, keywords';
COMMENT ON COLUMN classification_labels.departments_access IS 'Department access settings: {all: boolean, specific: []}';
COMMENT ON COLUMN classification_labels.visual_marking IS 'Visual marking settings: {header_text: "", footer_text: ""}';

