-- Seed account test data for external scenarios.
-- Covers EMPLOYEE / RELATION / INTERMEDIARY / EXTERNAL owner types.

INSERT INTO ccdi_account_info (
  account_no,
  account_type,
  bank_scope,
  account_name,
  owner_type,
  owner_id,
  bank,
  bank_code,
  currency,
  is_self_account,
  monthly_avg_trans_count,
  monthly_avg_trans_amount,
  trans_freq_type,
  dr_max_single_amount,
  cr_max_single_amount,
  dr_max_daily_amount,
  cr_max_daily_amount,
  trans_risk_level,
  status,
  effective_date,
  invalid_date,
  create_by,
  update_by
)
SELECT
  '622202440000010001',
  'BANK',
  'EXTERNAL',
  '测试员工A行外卡',
  'EMPLOYEE',
  '330101199001010001',
  '杭州联合银行城东支行',
  'HZLH001',
  'CNY',
  1,
  12,
  28600.00,
  'MEDIUM',
  8800.00,
  12000.00,
  16000.00,
  22000.00,
  'MEDIUM',
  1,
  '2026-04-13',
  NULL,
  'system',
  'system'
FROM dual
WHERE NOT EXISTS (
  SELECT 1 FROM ccdi_account_info WHERE account_no = '622202440000010001'
);

INSERT INTO ccdi_account_info (
  account_no,
  account_type,
  bank_scope,
  account_name,
  owner_type,
  owner_id,
  bank,
  bank_code,
  currency,
  is_self_account,
  monthly_avg_trans_count,
  monthly_avg_trans_amount,
  trans_freq_type,
  dr_max_single_amount,
  cr_max_single_amount,
  dr_max_daily_amount,
  cr_max_daily_amount,
  trans_risk_level,
  status,
  effective_date,
  invalid_date,
  create_by,
  update_by
)
SELECT
  'ZQ330101199104010101',
  'SECURITIES',
  'EXTERNAL',
  '边界配偶甲',
  'RELATION',
  '330101199104010101',
  '国泰君安杭州营业部',
  'GTJAHZ01',
  'CNY',
  0,
  6,
  152000.00,
  'LOW',
  68000.00,
  72000.00,
  98000.00,
  116000.00,
  'HIGH',
  1,
  '2026-04-13',
  NULL,
  'system',
  'system'
FROM dual
WHERE NOT EXISTS (
  SELECT 1 FROM ccdi_account_info WHERE account_no = 'ZQ330101199104010101'
);

INSERT INTO ccdi_account_info (
  account_no,
  account_type,
  bank_scope,
  account_name,
  owner_type,
  owner_id,
  bank,
  bank_code,
  currency,
  is_self_account,
  monthly_avg_trans_count,
  monthly_avg_trans_amount,
  trans_freq_type,
  dr_max_single_amount,
  cr_max_single_amount,
  dr_max_daily_amount,
  cr_max_daily_amount,
  trans_risk_level,
  status,
  effective_date,
  invalid_date,
  create_by,
  update_by
)
SELECT
  '13700000035',
  'PAYMENT',
  'EXTERNAL',
  '模型异常中介',
  'INTERMEDIARY',
  '330101197901010055',
  '支付宝',
  'ALIPAY',
  'CNY',
  0,
  18,
  46800.00,
  'MEDIUM',
  9000.00,
  13800.00,
  18800.00,
  21600.00,
  'LOW',
  1,
  '2026-04-13',
  NULL,
  'system',
  'system'
FROM dual
WHERE NOT EXISTS (
  SELECT 1 FROM ccdi_account_info WHERE account_no = '13700000035'
);

INSERT INTO ccdi_account_info (
  account_no,
  account_type,
  bank_scope,
  account_name,
  owner_type,
  owner_id,
  bank,
  bank_code,
  currency,
  is_self_account,
  monthly_avg_trans_count,
  monthly_avg_trans_amount,
  trans_freq_type,
  dr_max_single_amount,
  cr_max_single_amount,
  dr_max_daily_amount,
  cr_max_daily_amount,
  trans_risk_level,
  status,
  effective_date,
  invalid_date,
  create_by,
  update_by
)
SELECT
  'wx-ext-20260413-001',
  'OTHER',
  'EXTERNAL',
  '外部合作机构测试',
  'EXTERNAL',
  '91330100EXT20260413',
  '微信支付',
  'WXPAY',
  'CNY',
  0,
  9,
  9800.00,
  'LOW',
  3200.00,
  4100.00,
  5600.00,
  7000.00,
  'LOW',
  1,
  '2026-04-13',
  NULL,
  'system',
  'system'
FROM dual
WHERE NOT EXISTS (
  SELECT 1 FROM ccdi_account_info WHERE account_no = 'wx-ext-20260413-001'
);
