-- Drop tables that depend on service_type_setting
DROP TABLE IF EXISTS service_type_setting;

-- Drop product-related tables and types
DROP TABLE IF EXISTS product;
DROP TYPE IF EXISTS tier_group;

-- Drop onboarding-related tables and types
DROP TABLE IF EXISTS verification_key;
DROP TABLE IF EXISTS onboarding_user;
DROP TYPE IF EXISTS verification_status;
DROP TYPE IF EXISTS onboarding_status;

-- Drop staff-related tables and types
DROP TABLE IF EXISTS staff_session;
DROP TABLE IF EXISTS user_agent;
DROP TABLE IF EXISTS staff;
DROP TYPE IF EXISTS password_status;

-- Drop mobile app-related tables and types
DROP TABLE IF EXISTS user_devices;
DROP TABLE IF EXISTS user_session;
DROP TABLE IF EXISTS linked_accounts;
DROP TABLE IF EXISTS users;
DROP TYPE IF EXISTS device_type;
DROP TYPE IF EXISTS registeration_type;
DROP TYPE IF EXISTS customer_group;

-- Drop linked accounts and beneficiary tables and types
DROP TABLE IF EXISTS beneficiary;
DROP TYPE IF EXISTS fund_destination;

-- Drop maker checker-related tables and types
DROP TABLE IF EXISTS workflow;
DROP TYPE IF EXISTS approval_status;
DROP TYPE IF EXISTS action_type;
DROP TYPE IF EXISTS context_type;

-- Drop authorization-related tables and types
DROP TRIGGER IF EXISTS enforce_unique_array ON policy;
DROP FUNCTION IF EXISTS check_unique_array;
DROP TABLE IF EXISTS policy;
DROP TABLE IF EXISTS roles;
DROP TYPE IF EXISTS policy_action;
DROP TYPE IF EXISTS policy_object;

-- Drop bank-related tables and types
DROP TABLE IF EXISTS bank;
DROP TABLE IF EXISTS flagged_users;

-- Drop transaction-related tables and types
DROP TABLE IF EXISTS transaction_daily;
DROP TABLE IF EXISTS system_limits;
DROP TABLE IF EXISTS transactions;
DROP TYPE IF EXISTS payment_status;
DROP TYPE IF EXISTS service_type;
DROP TYPE IF EXISTS channel;
DROP TYPE IF EXISTS transaction_category;
DROP TYPE IF EXISTS registration_type;

-- Drop branches and related tables
DROP TABLE IF EXISTS branches;
DROP TABLE IF EXISTS cities;
DROP TABLE IF EXISTS districts;
DROP TABLE IF EXISTS regions;

-- Drop activity logs
DROP TABLE IF EXISTS activity;

-- Drop ussd account and related enums
DROP TABLE IF EXISTS ussd_account;
DROP TYPE IF EXISTS ua_pin_status;
DROP TYPE IF EXISTS ua_status;
DROP TYPE IF EXISTS ua_registaration_type;

-- Drop Ticket
DROP TABLE IF EXIST ticket;

