-- M01-B sanitized legacy database fixture.
-- All names, identifiers, timestamps, and amounts are synthetic.

CREATE TABLE member_store_info (
  id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
  tenant_id BIGINT UNSIGNED NOT NULL,
  store_name VARCHAR(128) NOT NULL,
  status VARCHAR(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE member_room_info (
  id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
  tenant_id BIGINT UNSIGNED NOT NULL,
  store_id BIGINT UNSIGNED NOT NULL,
  room_name VARCHAR(128) NOT NULL,
  room_no VARCHAR(64) NOT NULL,
  status VARCHAR(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE member_order_info (
  id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
  tenant_id BIGINT UNSIGNED NOT NULL,
  room_id BIGINT UNSIGNED NOT NULL,
  order_no VARCHAR(64) NOT NULL,
  status VARCHAR(32) NOT NULL,
  start_time DATETIME NOT NULL,
  end_time DATETIME NOT NULL,
  price DECIMAL(10, 2) NOT NULL,
  pay_price DECIMAL(10, 2) NULL,
  renew_price DECIMAL(10, 2) NULL,
  group_pay_price DECIMAL(10, 2) NULL,
  refund_price DECIMAL(10, 2) NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE member_device_info (
  id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
  tenant_id BIGINT UNSIGNED NOT NULL,
  room_id BIGINT UNSIGNED NOT NULL,
  device_name VARCHAR(128) NOT NULL,
  device_id VARCHAR(64) NOT NULL,
  status VARCHAR(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO member_store_info (id, tenant_id, store_name, status) VALUES
  (101, 1, '脱敏一号店', 'OPEN'),
  (201, 2, '隔离租户门店', 'OPEN');

INSERT INTO member_room_info (id, tenant_id, store_id, room_name, room_no, status) VALUES
  (1001, 1, 101, '青竹间', 'A01', 'AVAILABLE'),
  (1002, 1, 101, '墨玉间', 'A02', 'MAINTENANCE'),
  (2001, 2, 201, '隔离房间', 'B01', 'AVAILABLE');

INSERT INTO member_order_info (
  id, tenant_id, room_id, order_no, status, start_time, end_time,
  price, pay_price, renew_price, group_pay_price, refund_price
) VALUES
  (
    5001, 1, 1001, 'LEGACY-SANITIZED-001', 'PAID',
    '2026-06-18 02:00:00', '2026-06-18 04:30:00',
    25.80, 20.00, 5.80, 0.00, NULL
  ),
  (
    5002, 2, 2001, 'LEGACY-TENANT-ISOLATED', 'PAID',
    '2026-06-18 03:00:00', '2026-06-18 04:00:00',
    99.99, 99.99, NULL, NULL, 0.01
  );

INSERT INTO member_device_info (
  id, tenant_id, room_id, device_name, device_id, status
) VALUES
  (9001, 1, 1001, '脱敏门禁控制箱', 'SANITIZED-DEVICE-001', 'ONLINE'),
  (9002, 2, 2001, '隔离租户设备', 'SANITIZED-DEVICE-002', 'OFFLINE');
