CREATE DATABASE protect_system;
USE protect_system;

CREATE TABLE admins (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(100),
password VARCHAR(255),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE protected_links (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255),
slug VARCHAR(255),
password VARCHAR(255),
target_url TEXT,
access_count INT DEFAULT 0,
status ENUM('active','inactive') DEFAULT 'active',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE access_logs (
id INT AUTO_INCREMENT PRIMARY KEY,
link_id INT,
ip_address VARCHAR(100),
user_agent TEXT,
accessed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

INSERT INTO admins(username,password)
VALUES(
'admin',
'$2y$10$e0NRG0b7xGX2YeliYg5OtuhNangNh4tW7x1YgnSUZXoqBYwygJyI6'
);
