-- 10. SCHOOL SETTINGS
-- ---------------------------------------------------------------------

CREATE TABLE school_settings (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  school_name VARCHAR(255) NOT NULL,
  school_address VARCHAR(255) DEFAULT NULL,
  school_motto VARCHAR(255) DEFAULT NULL,
  school_phone VARCHAR(50) DEFAULT NULL,
  school_email VARCHAR(150) DEFAULT NULL,
  school_website VARCHAR(150) DEFAULT NULL,
  school_whatsapp VARCHAR(50) DEFAULT NULL,
  school_short_name VARCHAR(50) DEFAULT NULL,
  adm_no_prefix VARCHAR(20) DEFAULT NULL,
  logo_url VARCHAR(255) DEFAULT NULL,
  favicon_url VARCHAR(255) DEFAULT NULL,
  stamp_url VARCHAR(255) DEFAULT NULL,
  use_scratch_card TINYINT(1) NOT NULL DEFAULT 1,
  show_position_on_result TINYINT(1) NOT NULL DEFAULT 1,
  updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE notifications (
  id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  title VARCHAR(150) DEFAULT NULL,
  message TEXT NOT NULL,
  target ENUM('staff','student','guardian','all') NOT NULL DEFAULT 'all',
  created_by BIGINT UNSIGNED DEFAULT NULL,
  is_active TINYINT(1) NOT NULL DEFAULT 1,
  created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  CONSTRAINT fk_notif_creator FOREIGN KEY (created_by) REFERENCES users(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
