-- Create finance_payouts table
CREATE TABLE IF NOT EXISTS finance_payouts (
  payout_id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  requisition_id VARCHAR(64) NOT NULL,
  payout_date DATE NOT NULL,
  method VARCHAR(32) NOT NULL,
  payment_details VARCHAR(255) NOT NULL,
  note TEXT,
  paid_by_name VARCHAR(128) NOT NULL,
  paid_by_id VARCHAR(32) NOT NULL,
  payment_proof_url VARCHAR(255),
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME DEFAULT NULL
);

-- Add paid_status and paid_at to requisition tables
ALTER TABLE finance_requisitions ADD COLUMN paid_status ENUM('Pending','Paid') DEFAULT 'Pending', ADD COLUMN paid_at DATETIME DEFAULT NULL;
ALTER TABLE finance_benevolence ADD COLUMN paid_status ENUM('Pending','Paid') DEFAULT 'Pending', ADD COLUMN paid_at DATETIME DEFAULT NULL;
ALTER TABLE finance_expenses_claims ADD COLUMN paid_status ENUM('Pending','Paid') DEFAULT 'Pending', ADD COLUMN paid_at DATETIME DEFAULT NULL;
