USE forex_platform;

SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE users;
TRUNCATE TABLE clients;
TRUNCATE TABLE positions;
TRUNCATE TABLE deposits;
TRUNCATE TABLE tickets;
TRUNCATE TABLE market_pairs;
TRUNCATE TABLE trading_assets;
TRUNCATE TABLE trade_orders;
TRUNCATE TABLE news;
SET FOREIGN_KEY_CHECKS = 1;

INSERT INTO users (id, name, email, password, role, client_id, token) VALUES
(1, 'Ariana Wells', 'admin@forex.test', '$2y$10$ehmhVnfSYJeO5hUYPiwpsuh7OTfemLJxbHH5wqazT3djDKkXCvGh.', 'admin', NULL, 'admin-f268c51a870b0ab49bcb626e2f27f4e10212619cc354044cfa2028a515cc700c'),
(2, 'Marco Silva', 'client@forex.test', '$2y$10$04zIXfvS6Xqg3YjatqLqD.YHdKO/58rdh6ZF3uQsoX.sU8UE/5yBi', 'client', 'CL-001', 'client-5142aa8243d3f2d431b297ad10df97188c40b83f32b1bc7818bdebe55160ecfa');

INSERT INTO clients (id, name, email, phone, status, kyc, equity, balance, risk, manager) VALUES
('CL-001', 'Marco Silva', 'client@forex.test', '+355 69 555 1031', 'Active', 'Verified', 28450, 27620, 'Medium', 'Ariana Wells'),
('CL-002', 'Lea Martin', 'lea@example.com', '+44 7700 900121', 'Active', 'Pending', 18320, 19000, 'Low', 'Ariana Wells'),
('CL-003', 'Daniel Price', 'daniel@example.com', '+1 212 555 0182', 'Review', 'Requested', 74200, 69050, 'High', 'Nora Singh');

INSERT INTO positions (id, client_id, pair, side, lots, entry, current, pnl) VALUES
('POS-1001', 'CL-001', 'EUR/USD', 'Buy', 1.2, 1.0864, 1.0918, 648),
('POS-1002', 'CL-001', 'XAU/USD', 'Sell', 0.4, 2388.2, 2379.7, 340),
('POS-1003', 'CL-003', 'GBP/JPY', 'Buy', 2, 201.12, 200.76, -458);

INSERT INTO deposits (id, client_id, amount, method, status, created_at) VALUES
('DEP-0001', 'CL-001', 5000, 'SEPA Bank Transfer', 'Approved', '2026-07-08'),
('DEP-0002', 'CL-002', 2500, 'Card', 'Pending', '2026-07-12');

INSERT INTO tickets (id, client_id, subject, priority, status, created_at) VALUES
('TCK-0001', 'CL-001', 'Need leverage review before London session', 'High', 'Open', '2026-07-13'),
('TCK-0002', 'CL-003', 'KYC proof of address uploaded', 'Medium', 'Waiting', '2026-07-11');

INSERT INTO market_pairs (symbol, bid, ask, change_percent) VALUES
('EUR/USD', 1.0916, 1.0918, 0.24),
('GBP/USD', 1.3038, 1.3041, -0.11),
('USD/JPY', 157.42, 157.45, 0.08),
('XAU/USD', 2379.7, 2380.2, 0.37);

INSERT INTO trading_assets (symbol, tv_symbol, asset_group, bid, ask, change_percent, spread, pip, margin, swap_value) VALUES
('EUR/USD', 'FX:EURUSD', 'Forex', 1.0916, 1.0918, 0.24, '0.8 pip', 0.0002, 109, -1.20),
('GBP/USD', 'FX:GBPUSD', 'Forex', 1.3038, 1.3041, -0.11, '1.1 pip', 0.0003, 130, -0.90),
('USD/JPY', 'FX:USDJPY', 'Forex', 157.42, 157.45, 0.08, '1.4 pip', 0.0300, 157, 0.40),
('XAU/USD', 'OANDA:XAUUSD', 'Metals', 2379.70, 2380.20, 0.37, '50 pts', 0.5000, 238, -3.40),
('XAG/USD', 'OANDA:XAGUSD', 'Metals', 30.84, 30.88, -0.18, '4 pts', 0.0400, 62, -1.10),
('BTC/USD', 'COINBASE:BTCUSD', 'Crypto', 64120, 64155, 1.26, '€35', 35.0000, 1282, 0),
('ETH/USD', 'COINBASE:ETHUSD', 'Crypto', 3428, 3432, 0.74, '€4', 4.0000, 171, 0),
('US500', 'FOREXCOM:SPXUSD', 'Indices', 5638.20, 5639.10, 0.31, '0.9', 0.9000, 282, -0.70),
('NAS100', 'FOREXCOM:NSXUSD', 'Indices', 20484.10, 20486.30, 0.48, '2.2', 2.2000, 1024, -1.60),
('WTI', 'TVC:USOIL', 'Energies', 82.14, 82.18, -0.22, '4 pts', 0.0400, 82, -0.50);

INSERT INTO trade_orders (id, client_id, symbol, side, order_type, volume, leverage, price, stop_loss, take_profit, status, created_at) VALUES
('ORD-0001', 'CL-001', 'EUR/USD', 'Buy', 'Market', 0.10, '1:100', 1.0918, 1.0870, 1.0980, 'Filled', '2026-07-14 09:42:18'),
('ORD-0002', 'CL-001', 'XAU/USD', 'Sell', 'Limit', 0.20, '1:100', 2388.00, 2396.00, 2372.00, 'Pending', '2026-07-14 11:10:03');

INSERT INTO news (title, impact, event_time) VALUES
('Euro steadies while traders await inflation data', 'Medium', '09:30'),
('Gold holds support after risk-off flows', 'High', '12:00');
