-- Initial system dictionary seed data.
-- Target database: takeout_dictionary_db

-- ========================================
-- 1. ORDER_STATUS
-- ========================================
INSERT INTO dictionary_groups ("Id", "TenantId", "Code", "Name", "Scope", "AllowOverride", "IsEnabled", "Description", "CreatedAt", "CreatedBy")
VALUES
  (1001, 0, 'order_status', '订单状态', 1, true, true, '外卖订单生命周期状态', CURRENT_TIMESTAMP, 0)
ON CONFLICT ("TenantId", "Code") DO NOTHING;

INSERT INTO dictionary_items ("Id", "TenantId", "GroupId", "Key", "Value", "IsDefault", "IsEnabled", "SortOrder", "Description", "CreatedAt", "CreatedBy")
VALUES
  (10011, 0, 1001, 'PENDING', '{"zh-CN":"待接单","en":"Pending"}', true, true, 10, '订单已创建，等待商家接单', CURRENT_TIMESTAMP, 0),
  (10012, 0, 1001, 'ACCEPTED', '{"zh-CN":"已接单","en":"Accepted"}', false, true, 20, '商家已接受订单', CURRENT_TIMESTAMP, 0),
  (10013, 0, 1001, 'PREPARING', '{"zh-CN":"制作中","en":"Preparing"}', false, true, 30, '商家正在准备餐品', CURRENT_TIMESTAMP, 0),
  (10014, 0, 1001, 'DELIVERING', '{"zh-CN":"配送中","en":"Delivering"}', false, true, 40, '骑手正在配送', CURRENT_TIMESTAMP, 0),
  (10015, 0, 1001, 'COMPLETED', '{"zh-CN":"已完成","en":"Completed"}', false, true, 50, '订单已送达', CURRENT_TIMESTAMP, 0),
  (10016, 0, 1001, 'CANCELLED', '{"zh-CN":"已取消","en":"Cancelled"}', false, true, 60, '订单已取消', CURRENT_TIMESTAMP, 0),
  (10017, 0, 1001, 'REFUNDED', '{"zh-CN":"已退款","en":"Refunded"}', false, true, 70, '订单已退款', CURRENT_TIMESTAMP, 0)
ON CONFLICT ("TenantId", "GroupId", "Key") DO NOTHING;

-- ========================================
-- 2. PAYMENT_METHOD
-- ========================================
INSERT INTO dictionary_groups ("Id", "TenantId", "Code", "Name", "Scope", "AllowOverride", "IsEnabled", "Description", "CreatedAt", "CreatedBy")
VALUES
  (1002, 0, 'payment_method', '支付方式', 1, true, true, '订单支付方式选项', CURRENT_TIMESTAMP, 0)
ON CONFLICT ("TenantId", "Code") DO NOTHING;

INSERT INTO dictionary_items ("Id", "TenantId", "GroupId", "Key", "Value", "IsDefault", "IsEnabled", "SortOrder", "Description", "CreatedAt", "CreatedBy")
VALUES
  (10021, 0, 1002, 'ALIPAY', '{"zh-CN":"支付宝","en":"Alipay"}', true, true, 10, '支付宝在线支付', CURRENT_TIMESTAMP, 0),
  (10022, 0, 1002, 'WECHAT', '{"zh-CN":"微信支付","en":"WeChat Pay"}', false, true, 20, '微信在线支付', CURRENT_TIMESTAMP, 0),
  (10023, 0, 1002, 'CREDIT_CARD', '{"zh-CN":"信用卡","en":"Credit Card"}', false, true, 30, '信用卡支付', CURRENT_TIMESTAMP, 0),
  (10024, 0, 1002, 'BALANCE', '{"zh-CN":"余额支付","en":"Balance"}', false, true, 40, '账户余额支付', CURRENT_TIMESTAMP, 0)
ON CONFLICT ("TenantId", "GroupId", "Key") DO NOTHING;

-- ========================================
-- 3. SHIPPING_METHOD
-- ========================================
INSERT INTO dictionary_groups ("Id", "TenantId", "Code", "Name", "Scope", "AllowOverride", "IsEnabled", "Description", "CreatedAt", "CreatedBy")
VALUES
  (1003, 0, 'shipping_method', '配送方式', 1, true, true, '订单配送方式', CURRENT_TIMESTAMP, 0)
ON CONFLICT ("TenantId", "Code") DO NOTHING;

INSERT INTO dictionary_items ("Id", "TenantId", "GroupId", "Key", "Value", "IsDefault", "IsEnabled", "SortOrder", "Description", "CreatedAt", "CreatedBy")
VALUES
  (10031, 0, 1003, 'SYSTEM_DELIVERY', '{"zh-CN":"系统配送","en":"System Delivery"}', true, true, 10, '系统自有骑手配送', CURRENT_TIMESTAMP, 0),
  (10032, 0, 1003, 'MERCHANT_DELIVERY', '{"zh-CN":"商家配送","en":"Merchant Delivery"}', false, true, 20, '商家自行配送', CURRENT_TIMESTAMP, 0),
  (10033, 0, 1003, 'SELF_PICKUP', '{"zh-CN":"到店自取","en":"Self Pickup"}', false, true, 30, '顾客到店自取', CURRENT_TIMESTAMP, 0)
ON CONFLICT ("TenantId", "GroupId", "Key") DO NOTHING;

-- ========================================
-- 4. PRODUCT_CATEGORY
-- ========================================
INSERT INTO dictionary_groups ("Id", "TenantId", "Code", "Name", "Scope", "AllowOverride", "IsEnabled", "Description", "CreatedAt", "CreatedBy")
VALUES
  (1004, 0, 'product_category', '商品分类', 1, false, true, '外卖商品通用分类 (不允许租户覆盖)', CURRENT_TIMESTAMP, 0)
ON CONFLICT ("TenantId", "Code") DO NOTHING;

INSERT INTO dictionary_items ("Id", "TenantId", "GroupId", "Key", "Value", "IsDefault", "IsEnabled", "SortOrder", "Description", "CreatedAt", "CreatedBy")
VALUES
  (10041, 0, 1004, 'STAPLE_FOOD', '{"zh-CN":"主食","en":"Staple Food"}', false, true, 10, '米饭、面条等主食', CURRENT_TIMESTAMP, 0),
  (10042, 0, 1004, 'APPETIZER', '{"zh-CN":"小吃/开胃菜","en":"Appetizer"}', false, true, 20, '小吃和开胃菜', CURRENT_TIMESTAMP, 0),
  (10043, 0, 1004, 'MAIN_COURSE', '{"zh-CN":"主菜","en":"Main Course"}', true, true, 30, '正餐主菜', CURRENT_TIMESTAMP, 0),
  (10044, 0, 1004, 'BEVERAGE', '{"zh-CN":"饮品","en":"Beverage"}', false, true, 40, '饮料、茶饮等', CURRENT_TIMESTAMP, 0),
  (10045, 0, 1004, 'DESSERT', '{"zh-CN":"甜品","en":"Dessert"}', false, true, 50, '甜品、糕点', CURRENT_TIMESTAMP, 0)
ON CONFLICT ("TenantId", "GroupId", "Key") DO NOTHING;

-- ========================================
-- 5. USER_ROLE
-- ========================================
INSERT INTO dictionary_groups ("Id", "TenantId", "Code", "Name", "Scope", "AllowOverride", "IsEnabled", "Description", "CreatedAt", "CreatedBy")
VALUES
  (1005, 0, 'user_role', '用户角色', 1, false, true, '系统用户角色类型 (系统级，不可覆盖)', CURRENT_TIMESTAMP, 0)
ON CONFLICT ("TenantId", "Code") DO NOTHING;

INSERT INTO dictionary_items ("Id", "TenantId", "GroupId", "Key", "Value", "IsDefault", "IsEnabled", "SortOrder", "Description", "CreatedAt", "CreatedBy")
VALUES
  (10052, 0, 1005, 'TENANT_ADMIN', '{"zh-CN":"租户管理员","en":"Tenant Admin"}', false, true, 20, '租户企业管理员', CURRENT_TIMESTAMP, 0),
  (10053, 0, 1005, 'TENANT_USER', '{"zh-CN":"租户员工","en":"Tenant User"}', true, true, 30, '租户普通员工', CURRENT_TIMESTAMP, 0),
  (10054, 0, 1005, 'CUSTOMER', '{"zh-CN":"顾客","en":"Customer"}', false, true, 40, '终端用户/顾客', CURRENT_TIMESTAMP, 0)
ON CONFLICT ("TenantId", "GroupId", "Key") DO NOTHING;
