CREATE TABLE `ucard_config` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `code` varchar(50) NOT NULL COMMENT '配置编码',
  `name` varchar(100) NOT NULL COMMENT '配置名称',
  `api_url` varchar(255) NOT NULL COMMENT 'API基础URL',
  `merchant_id` varchar(50) NOT NULL COMMENT '商户ID',
  `merchant_key` varchar(100) NOT NULL COMMENT '商户密钥',
  `activate_card_url` varchar(255) DEFAULT NULL COMMENT '激活卡片URL',
  `recharge_estimate_url` varchar(255) DEFAULT NULL COMMENT '充值预估URL',
  `recharge_url` varchar(255) DEFAULT NULL COMMENT '充值URL',
  `recharge_order_url` varchar(255) DEFAULT NULL COMMENT '充值订单查询URL',
  `balance_url` varchar(255) DEFAULT NULL COMMENT '余额查询URL',
  `transactions_url` varchar(255) DEFAULT NULL COMMENT '交易记录查询URL',
  `card_types_url` varchar(255) DEFAULT NULL COMMENT '卡片类型列表URL',
  `merchant_account_url` varchar(255) DEFAULT NULL COMMENT '商户账户查询URL',
  `merchant_user_register_url` varchar(255) DEFAULT NULL COMMENT '商户用户注册URL',
  `merchant_user_update_url` varchar(255) DEFAULT NULL COMMENT '商户用户更新URL',
  `kyc_attachment_url` varchar(255) DEFAULT NULL COMMENT 'KYC附件上传URL',
  `kyc_submit_url` varchar(255) DEFAULT NULL COMMENT 'KYC提交URL',
  `kyc_status_url` varchar(255) DEFAULT NULL COMMENT 'KYC状态查询URL',
  `password_reset_url` varchar(255) DEFAULT NULL COMMENT '密码重置URL',
  `freeze_card_url` varchar(255) DEFAULT NULL COMMENT '卡片冻结URL',
  `unfreeze_card_url` varchar(255) DEFAULT NULL COMMENT '卡片解冻URL',
  `bank_list_url` varchar(255) DEFAULT NULL COMMENT '速汇银行列表URL',
  `exchange_rate_url` varchar(255) DEFAULT NULL COMMENT '汇率查询URL',
  `validate_transfer_url` varchar(255) DEFAULT NULL COMMENT '代付校验URL',
  `validate_payer_url` varchar(255) DEFAULT NULL COMMENT '代付付款人校验URL',
  `validate_payee_url` varchar(255) DEFAULT NULL COMMENT '代付收款人校验URL',
  `transfer_url` varchar(255) DEFAULT NULL COMMENT '代付URL',
  `order_list_url` varchar(255) DEFAULT NULL COMMENT '订单列表查询URL',
  `dispute_url` varchar(255) DEFAULT NULL COMMENT '调单提交URL',
  `order_result_url` varchar(255) DEFAULT NULL COMMENT '订单结果查询URL',
  `notify_url` varchar(255) DEFAULT NULL COMMENT '回调通知URL',
  `verify_3ds_url` varchar(255) DEFAULT NULL COMMENT '3DS校验URL',
  `bill_statement_url` varchar(255) DEFAULT NULL COMMENT '账单查询URL',
  `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否启用',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Ucard配置表';

-- 插入默认配置
INSERT INTO `ucard_config` (
  `code`, `name`, `api_url`, `merchant_id`, `merchant_key`, 
  `activate_card_url`, `recharge_estimate_url`, `recharge_url`, 
  `recharge_order_url`, `balance_url`, `transactions_url`, 
  `card_types_url`, `merchant_account_url`, `merchant_user_register_url`, 
  `merchant_user_update_url`, `kyc_attachment_url`, `kyc_submit_url`, 
  `kyc_status_url`, `password_reset_url`, `freeze_card_url`, 
  `unfreeze_card_url`, `bank_list_url`, `exchange_rate_url`, 
  `validate_transfer_url`, `validate_payer_url`, `validate_payee_url`, 
  `transfer_url`, `order_list_url`, `dispute_url`, `order_result_url`, 
  `notify_url`, `verify_3ds_url`, `bill_statement_url`, `enabled`, 
  `remark`
) VALUES (
  'DEFAULT', '默认配置', 'https://api.ucard.com/v1', 
  '${UCARD_MERCHANT_ID}', '${UCARD_MERCHANT_KEY}',
  '${api_url}/card/activate', '${api_url}/card/recharge/estimate', 
  '${api_url}/card/recharge', '${api_url}/card/recharge/order',
  '${api_url}/card/balance', '${api_url}/card/transactions',
  '${api_url}/card/types', '${api_url}/merchant/account',
  '${api_url}/merchant/user/register', '${api_url}/merchant/user/update',
  '${api_url}/merchant/user/kyc/attachment', '${api_url}/merchant/user/kyc/submit',
  '${api_url}/merchant/user/kyc/status', '${api_url}/card/password/reset',
  '${api_url}/card/freeze', '${api_url}/card/unfreeze',
  '${api_url}/transfer/banks', '${api_url}/transfer/rate',
  '${api_url}/transfer/validate', '${api_url}/transfer/validate/payer',
  '${api_url}/transfer/validate/payee', '${api_url}/transfer',
  '${api_url}/transfer/orders', '${api_url}/transfer/dispute',
  '${api_url}/transfer/order/result', '${api_url}/notify',
  '${api_url}/card/3ds/verify', '${api_url}/card/bill/statement',
  1, '默认Ucard配置'
); 