-- Buat Database
CREATE DATABASE IF NOT EXISTS agency_website_db;
USE agency_website_db;

-- Tabel Websites (Layanan Sewa)
CREATE TABLE IF NOT EXISTS websites (
    id INT AUTO_INCREMENT PRIMARY KEY,
    user_id INT,
    domain_name VARCHAR(100) NOT NULL,
    plan_type ENUM('Starter', 'Business', 'E-Commerce') DEFAULT 'Starter',
    status ENUM('active', 'expired', 'suspended') DEFAULT 'active',
    expiry_date DATE NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);

-- Dummy Data Website
INSERT INTO websites (user_id, domain_name, plan_type, status, expiry_date) VALUES 
(1, 'tokosepatu.com', 'E-Commerce', 'active', DATE_ADD(CURDATE(), INTERVAL 30 DAY)),
(1, 'lenzaphoto.id', 'Starter', 'expired', DATE_SUB(CURDATE(), INTERVAL 2 DAY));
