USE borrow_system_new;

INSERT INTO users (username, password, email, first_name, last_name, role, is_admin)
VALUES
  ('admin',        'password123', 'admin@example.com',        'System',  'Admin',      3, 1),
  ('jdoe',         'password123', 'jdoe@example.com',         'John',    'Doe',        1, 0),
  ('asmith',       'password123', 'asmith@example.com',       'Anna',    'Smith',      1, 0),
  ('bjones',       'password123', 'bjones@example.com',       'Bob',     'Jones',      1, 0),
  ('cschmidt',     'password123', 'cschmidt@example.com',     'Clara',   'Schmidt',    2, 0),
  ('dmueller',     'password123', 'dmueller@example.com',     'David',   'Müller',     2, 0),
  ('efranke',      'password123', 'efranke@example.com',      'Eva',     'Franke',     1, 0),
  ('fmeier',       'password123', 'fmeier@example.com',       'Felix',   'Meier',      1, 0),
  ('gkoch',        'password123', 'gkoch@example.com',        'Greta',   'Koch',       1, 0),
  ('hhoffmann',    'password123', 'hhoffmann@example.com',    'Hanna',   'Hoffmann',   2, 0),
  ('isommer',      'password123', 'isommer@example.com',      'Ines',    'Sommer',     1, 0),
  ('jkeller',      'password123', 'jkeller@example.com',      'Jonas',   'Keller',     1, 0),
  ('kroth',        'password123', 'kroth@example.com',        'Karl',    'Roth',       2, 0),
  ('lbrand',       'password123', 'lbrand@example.com',       'Lisa',    'Brand',      1, 0),
  ('mmayer',       'password123', 'mmayer@example.com',       'Markus',  'Mayer',      1, 0),
  ('nweber',       'password123', 'nweber@example.com',       'Nina',    'Weber',      1, 0),
  ('opeters',      'password123', 'opeters@example.com',      'Oliver',  'Peters',     2, 0),
  ('pschulz',      'password123', 'pschulz@example.com',      'Paula',   'Schulz',     1, 0),
  ('qwolf',        'password123', 'qwolf@example.com',        'Quentin', 'Wolf',       1, 0),
  ('rberger',      'password123', 'rberger@example.com',      'Robin',   'Berger',     1, 0),
  ('slehmann',     'password123', 'slehmann@example.com',     'Sarah',   'Lehmann',    2, 0),
  ('tbaur',        'password123', 'tbaur@example.com',        'Tom',     'Baur',       1, 0),
  ('uhofer',       'password123', 'uhofer@example.com',       'Ute',     'Hofer',      1, 0),
  ('vschneider',   'password123', 'vschneider@example.com',   'Vera',    'Schneider',  1, 0),
  ('wlang',        'password123', 'wlang@example.com',        'Walter',  'Lang',       2, 0),
  ('xseidel',      'password123', 'xseidel@example.com',      'Xenia',   'Seidel',     1, 0),
  ('yjung',        'password123', 'yjung@example.com',        'Yann',    'Jung',       1, 0),
  ('zzimmer',      'password123', 'zzimmer@example.com',      'Zoe',     'Zimmer',     1, 0);

INSERT INTO items (item_name, can_borrow_role, in_safe, safe_nr, door_key, last_borrowed_person, currently_borrowing)
VALUES
  ('Laptop 01',             1, 1,  1, 101, NULL,        NULL),
  ('Laptop 02',             1, 1,  2, 102, 'jdoe',      NULL),
  ('Laptop 03',             1, 1,  3, 103, 'asmith',    'jdoe'),
  ('Beamer 01',             2, 1,  4, 104, 'cschmidt',  NULL),
  ('Beamer 02',             2, 1,  5, 105, 'dmueller',  'asmith'),
  ('Tablet 01',             1, 1,  6, 106, 'jdoe',      NULL),
  ('Tablet 02',             1, 1,  7, 107, 'bjones',    NULL),
  ('Kamera 01',             2, 1,  8, 108, 'efranke',   NULL),
  ('Kamera 02',             2, 1,  9, 109, 'fmeier',    'bjones'),
  ('Mikrofon Set 01',       1, 1, 10, 110, NULL,        NULL),
  ('Mikrofon Set 02',       1, 1, 11, 111, 'gkoch',     NULL),
  ('VR-Brille 01',          2, 1, 12, 112, 'hhoffmann', 'cschmidt'),
  ('Laborschlüssel 01',     2, 0, 13, 113, 'jkeller',   'jkeller'),
  ('Laborschlüssel 02',     2, 0, 14, 114, 'mmayer',    'mmayer'),
  ('Konferenztelefon 01',   2, 1, 15, 115, 'opeters',   NULL),
  ('Raspberry Pi Kit 01',   1, 1, NULL, NULL, NULL,     NULL),
  ('Raspberry Pi Kit 02',   1, 1, NULL, NULL, 'pschulz','pschulz'),
  ('Arduino Kit 01',        1, 1, NULL, NULL, NULL,     NULL),
  ('Arduino Kit 02',        1, 1, NULL, NULL, 'rberger','rberger'),
  ('Messgerät 01',          2, 1, NULL, NULL, NULL,     NULL);

INSERT INTO loans
  (username, lockers, loan_code, start_date, end_date, take_date, returned_date, loaned_items_id, loaned_items_name, deleted, note)
VALUES
  ('jdoe',       JSON_ARRAY('A1'),         '100001', '2025-01-10 09:00:00', '2025-01-15 18:00:00', '2025-01-10 09:05:00', '2025-01-15 17:30:00',
                  JSON_ARRAY(1),           JSON_ARRAY('Laptop 01'),                  0, 'Erstsemester Projektarbeit'),
  ('asmith',     JSON_ARRAY('A2'),         '100002', '2025-01-12 10:00:00', '2025-01-20 18:00:00', '2025-01-12 10:10:00', NULL,
                  JSON_ARRAY(2,6),         JSON_ARRAY('Laptop 02','Tablet 01'),      0, 'Gruppenprojekt Medienlabor'),
  ('bjones',     JSON_ARRAY('B1'),         '100003', '2025-01-13 08:30:00', '2025-01-14 18:00:00', '2025-01-13 08:35:00', '2025-01-14 16:45:00',
                  JSON_ARRAY(7),           JSON_ARRAY('Tablet 02'),                  0, 'Kurzzeit-Ausleihe'),
  ('cschmidt',   JSON_ARRAY('B2'),         '100004', '2025-01-15 09:00:00', '2025-01-22 18:00:00', '2025-01-15 09:00:00', NULL,
                  JSON_ARRAY(4,10),        JSON_ARRAY('Beamer 01','Mikrofon Set 01'),0, 'Konferenztechnik'),
  ('dmueller',   JSON_ARRAY('C1'),         '100005', '2025-01-16 09:00:00', '2025-01-18 18:00:00', '2025-01-16 09:15:00', '2025-01-18 17:50:00',
                  JSON_ARRAY(5),           JSON_ARRAY('Beamer 02'),                  0, 'Präsentation Fachbereich'),
  ('efranke',    JSON_ARRAY('C2'),         '100006', '2025-01-18 09:00:00', '2025-01-25 18:00:00', '2025-01-18 09:10:00', NULL,
                  JSON_ARRAY(8,9),         JSON_ARRAY('Kamera 01','Kamera 02'),      0, 'Videoprojekt'),
  ('fmeier',     JSON_ARRAY('D1'),         '100007', '2025-01-20 09:00:00', '2025-01-27 18:00:00', '2025-01-20 09:00:00', NULL,
                  JSON_ARRAY(1,3),         JSON_ARRAY('Laptop 01','Laptop 03'),      0, 'Softwareentwicklung'),
  ('gkoch',      JSON_ARRAY('D2'),         '100008', '2025-01-22 08:00:00', '2025-01-29 18:00:00', '2025-01-22 08:05:00', NULL,
                  JSON_ARRAY(6,11),        JSON_ARRAY('Tablet 01','Mikrofon Set 02'),0, 'Workshop Dokumentation'),
  ('hhoffmann',  JSON_ARRAY('E1'),         '100009', '2025-01-25 09:00:00', '2025-02-01 18:00:00', '2025-01-25 09:10:00', NULL,
                  JSON_ARRAY(12),          JSON_ARRAY('VR-Brille 01'),               0, 'VR-Workshop'),
  ('isommer',    JSON_ARRAY('E2'),         '100010', '2025-01-27 09:00:00', '2025-02-03 18:00:00', '2025-01-27 09:10:00', NULL,
                  JSON_ARRAY(1,6),         JSON_ARRAY('Laptop 01','Tablet 01'),      0, 'Prüfungsvorbereitung'),
  ('jkeller',    JSON_ARRAY('F1'),         '100011', '2025-02-01 09:00:00', '2025-02-08 18:00:00', '2025-02-01 09:20:00', NULL,
                  JSON_ARRAY(13),          JSON_ARRAY('Laborschlüssel 01'),          0, 'Laborzugang'),
  ('mmayer',     JSON_ARRAY('F2'),         '100012', '2025-02-02 09:00:00', '2025-02-09 18:00:00', '2025-02-02 09:10:00', NULL,
                  JSON_ARRAY(14),          JSON_ARRAY('Laborschlüssel 02'),          0, 'Laborversuch'),
  ('nweber',     JSON_ARRAY('G1'),         '100013', '2025-02-05 09:00:00', '2025-02-10 18:00:00', '2025-02-05 09:05:00', NULL,
                  JSON_ARRAY(2,7),         JSON_ARRAY('Laptop 02','Tablet 02'),      0, 'Projektarbeit'),
  ('opeters',    JSON_ARRAY('G2'),         '100014', '2025-02-06 09:00:00', '2025-02-13 18:00:00', '2025-02-06 09:00:00', NULL,
                  JSON_ARRAY(15),          JSON_ARRAY('Konferenztelefon 01'),        0, 'Telefonkonferenz'),
  ('pschulz',    JSON_ARRAY('H1'),         '100015', '2025-02-08 09:00:00', '2025-02-15 18:00:00', '2025-02-08 09:15:00', NULL,
                  JSON_ARRAY(17),          JSON_ARRAY('Raspberry Pi Kit 02'),        0, 'IoT-Projekt'),
  ('qwolf',      JSON_ARRAY('H2'),         '100016', '2025-02-10 09:00:00', '2025-02-17 18:00:00', '2025-02-10 09:05:00', NULL,
                  JSON_ARRAY(16,18),       JSON_ARRAY('Raspberry Pi Kit 01','Arduino Kit 01'), 0, 'Hardware-Prototyping'),
  ('rberger',    JSON_ARRAY('I1'),         '100017', '2025-02-12 09:00:00', '2025-02-19 18:00:00', '2025-02-12 09:05:00', NULL,
                  JSON_ARRAY(19),          JSON_ARRAY('Arduino Kit 02'),             0, 'Embedded Systems'),
  ('slehmann',   JSON_ARRAY('I2'),         '100018', '2025-02-14 09:00:00', '2025-02-21 18:00:00', '2025-02-14 09:10:00', NULL,
                  JSON_ARRAY(3,10),        JSON_ARRAY('Laptop 03','Mikrofon Set 01'),0, 'Seminarvortrag'),
  ('tbaur',      JSON_ARRAY('J1'),         '100019', '2025-02-15 09:00:00', '2025-02-22 18:00:00', '2025-02-15 09:00:00', NULL,
                  JSON_ARRAY(1,4,6),       JSON_ARRAY('Laptop 01','Beamer 01','Tablet 01'), 0, 'Große Präsentation'),
  ('uhofer',     JSON_ARRAY('J2'),         '100020', '2025-02-16 09:00:00', '2025-02-23 18:00:00', '2025-02-16 09:05:00', NULL,
                  JSON_ARRAY(5,11),        JSON_ARRAY('Beamer 02','Mikrofon Set 02'),0, 'Konferenzraum Setup'),
  ('vschneider', JSON_ARRAY('K1'),         '100021', '2025-02-18 09:00:00', '2025-02-25 18:00:00', '2025-02-18 09:10:00', NULL,
                  JSON_ARRAY(8),           JSON_ARRAY('Kamera 01'),                  0, 'Fotodokumentation'),
  ('wlang',      JSON_ARRAY('K2'),         '100022', '2025-02-20 09:00:00', '2025-02-27 18:00:00', '2025-02-20 09:15:00', NULL,
                  JSON_ARRAY(9,12),        JSON_ARRAY('Kamera 02','VR-Brille 01'),   0, 'Medienprojekt'),
  ('xseidel',    JSON_ARRAY('L1'),         '100023', '2025-02-22 09:00:00', '2025-03-01 18:00:00', '2025-02-22 09:05:00', NULL,
                  JSON_ARRAY(6),           JSON_ARRAY('Tablet 01'),                  0, 'Workshop Teilnahme'),
  ('yjung',      JSON_ARRAY('L2'),         '100024', '2025-02-24 09:00:00', '2025-03-03 18:00:00', '2025-02-24 09:20:00', NULL,
                  JSON_ARRAY(7,16),        JSON_ARRAY('Tablet 02','Raspberry Pi Kit 01'), 0, 'Projekt Dokumentation'),
  ('zzimmer',    JSON_ARRAY('M1'),         '100025', '2025-02-25 09:00:00', '2025-03-04 18:00:00', '2025-02-25 09:10:00', NULL,
                  JSON_ARRAY(18),          JSON_ARRAY('Arduino Kit 01'),             0, 'Hardware-Projekt'),
  ('jdoe',       JSON_ARRAY('M2'),         '100026', '2025-03-01 09:00:00', '2025-03-08 18:00:00', NULL,                     NULL,
                  JSON_ARRAY(1),           JSON_ARRAY('Laptop 01'),                  0, 'Reservierung, noch nicht abgeholt'),
  ('asmith',     JSON_ARRAY('N1'),         '100027', '2025-03-02 09:00:00', '2025-03-09 18:00:00', '2025-03-02 09:05:00', NULL,
                  JSON_ARRAY(2,3),         JSON_ARRAY('Laptop 02','Laptop 03'),      0, NULL),
  ('bjones',     JSON_ARRAY('N2'),         '100028', '2025-03-03 09:00:00', '2025-03-10 18:00:00', '2025-03-03 09:05:00', NULL,
                  JSON_ARRAY(4),           JSON_ARRAY('Beamer 01'),                  0, NULL),
  ('cschmidt',   JSON_ARRAY('O1'),         '100029', '2025-03-05 09:00:00', '2025-03-12 18:00:00', NULL,                     NULL,
                  JSON_ARRAY(5,10,11),     JSON_ARRAY('Beamer 02','Mikrofon Set 01','Mikrofon Set 02'), 0, 'Geplante Veranstaltung'),
  ('dmueller',   JSON_ARRAY('O2'),         '100030', '2025-03-06 09:00:00', '2025-03-13 18:00:00', NULL,                     NULL,
                  JSON_ARRAY(19,20),       JSON_ARRAY('Arduino Kit 02','Messgerät 01'), 0, 'Laborversuch');

INSERT INTO apiKeys (api_key, entry_name, last_used_at)
VALUES
  ('90000001', 'Mobile App',       '2025-02-01 10:00:00'),
  ('90000002', 'Kiosk Terminal',   '2025-02-02 11:30:00'),
  ('90000003', 'Reporting Tool',   '2025-02-03 09:15:00'),
  ('90000004', 'Admin Script',     '2025-02-04 14:45:00'),
  ('90000005', 'Externer Partner', '2025-02-05 16:10:00'),
  ('90000006', 'Test Client 01',   NULL),
  ('90000007', 'Test Client 02',   NULL),
  ('90000008', 'Integration A',    '2025-02-07 08:20:00'),
  ('90000009', 'Integration B',    '2025-02-08 12:00:00'),
  ('90000010', 'Legacy System',    '2025-02-09 18:30:00');