-- LifeError Database Backup
-- Generated: 2024-01-25 00:00:00
-- WARNING: Contains sensitive data

-- Users Table
CREATE TABLE users (
    id SERIAL PRIMARY KEY,
    username VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL,
    password_hash VARCHAR(255) NOT NULL,
    api_key VARCHAR(255),
    role VARCHAR(50) DEFAULT 'user'
);

INSERT INTO users (username, email, password_hash, api_key, role) VALUES
('admin', 'admin@lifeerror.local', '$2b$10$hashedpasswordhere', 'admin_api_key_xxxxxxxx', 'admin'),
('developer', 'dev@lifeerror.local', '$2b$10$devpasswordhash', 'dev_api_key_yyyyyyyy', 'developer'),
('service', 'service@lifeerror.local', '$2b$10$servicehash', 'service_api_key_zzzzzz', 'service');

-- Configuration Table
CREATE TABLE config (
    key VARCHAR(255) PRIMARY KEY,
    value TEXT
);

INSERT INTO config (key, value) VALUES
('jwt_secret', 'jwt_secret_from_database_xxxxxxxxxx'),
('encryption_key', 'aes256_master_key_yyyyyyyyyyyyyyyy'),
('api_master_key', 'api_master_access_key_zzzzzzzzzz'),
('aws_access_key', 'AKIAEXAMPLEFROMDB123'),
('aws_secret_key', 'secretkeyfromdatabasexxxxxxxxxxxxxxxx');

-- API Keys Table
CREATE TABLE api_keys (
    id SERIAL PRIMARY KEY,
    name VARCHAR(255),
    key_value VARCHAR(255),
    permissions TEXT
);

INSERT INTO api_keys (name, key_value, permissions) VALUES
('Production API', 'prod_api_key_xxxxxxxxxxxx', 'read,write,delete'),
('Monitoring', 'monitor_key_yyyyyyyyyyyy', 'read'),
('Admin Backdoor', 'backdoor_key_zzzzzzzzzzzz', 'all');
