/**
 * 保险监管相关 API 接口
 */

import request from '@/common/utils/request'

export const insuranceApi = {
  /**
   * 获取保险产品列表
   * @param {Object} params 查询参数
   */
  getInsuranceProducts(params) {
    return request.get('/insurance/products', { params })
  },

  /**
   * 获取保险产品详情
   * @param {number} id 产品ID
   */
  getInsuranceProductDetail(id) {
    return request.get(`/insurance/products/${id}`)
  },

  /**
   * 创建保险产品
   * @param {Object} productData 产品数据
   */
  createInsuranceProduct(productData) {
    return request.post('/insurance/products', productData)
  },

  /**
   * 更新保险产品
   * @param {number} id 产品ID
   * @param {Object} productData 产品数据
   */
  updateInsuranceProduct(id, productData) {
    return request.put(`/insurance/products/${id}`, productData)
  },

  /**
   * 获取保险政策列表
   * @param {Object} params 查询参数
   */
  getInsurancePolicies(params) {
    return request.get('/insurance/policies', { params })
  },

  /**
   * 获取保险政策详情
   * @param {number} id 政策ID
   */
  getInsurancePolicyDetail(id) {
    return request.get(`/insurance/policies/${id}`)
  },

  /**
   * 申请保险
   * @param {Object} applicationData 申请数据
   */
  applyInsurance(applicationData) {
    return request.post('/insurance/applications', applicationData)
  },

  /**
   * 获取保险申请列表
   * @param {Object} params 查询参数
   */
  getInsuranceApplications(params) {
    return request.get('/insurance/applications', { params })
  },

  /**
   * 获取保险申请详情
   * @param {number} id 申请ID
   */
  getInsuranceApplicationDetail(id) {
    return request.get(`/insurance/applications/${id}`)
  },

  /**
   * 审核保险申请
   * @param {number} id 申请ID
   * @param {Object} reviewData 审核数据
   */
  reviewInsuranceApplication(id, reviewData) {
    return request.post(`/insurance/applications/${id}/review`, reviewData)
  },

  /**
   * 承保
   * @param {number} id 申请ID
   * @param {Object} underwritingData 承保数据
   */
  underwriteInsurance(id, underwritingData) {
    return request.post(`/insurance/applications/${id}/underwrite`, underwritingData)
  },

  /**
   * 获取理赔申请列表
   * @param {Object} params 查询参数
   */
  getClaimApplications(params) {
    return request.get('/insurance/claims', { params })
  },

  /**
   * 获取理赔申请详情
   * @param {number} id 理赔ID
   */
  getClaimApplicationDetail(id) {
    return request.get(`/insurance/claims/${id}`)
  },

  /**
   * 提交理赔申请
   * @param {Object} claimData 理赔数据
   */
  submitClaimApplication(claimData) {
    return request.post('/insurance/claims', claimData)
  },

  /**
   * 审核理赔申请
   * @param {number} id 理赔ID
   * @param {Object} reviewData 审核数据
   */
  reviewClaimApplication(id, reviewData) {
    return request.post(`/insurance/claims/${id}/review`, reviewData)
  },

  /**
   * 理赔调查
   * @param {number} id 理赔ID
   * @param {Object} investigationData 调查数据
   */
  investigateClaim(id, investigationData) {
    return request.post(`/insurance/claims/${id}/investigate`, investigationData)
  },

  /**
   * 理赔结算
   * @param {number} id 理赔ID
   * @param {Object} settlementData 结算数据
   */
  settleClaim(id, settlementData) {
    return request.post(`/insurance/claims/${id}/settle`, settlementData)
  },

  /**
   * 获取保费计算
   * @param {Object} calculationData 计算数据
   */
  calculatePremium(calculationData) {
    return request.post('/insurance/premium-calculation', calculationData)
  },

  /**
   * 获取风险评估
   * @param {Object} assessmentData 评估数据
   */
  getRiskAssessment(assessmentData) {
    return request.post('/insurance/risk-assessment', assessmentData)
  },

  /**
   * 获取保险统计数据
   * @param {Object} params 查询参数
   */
  getInsuranceStats(params) {
    return request.get('/insurance/statistics', { params })
  },

  /**
   * 获取监管报告
   * @param {Object} params 查询参数
   */
  getSupervisionReports(params) {
    return request.get('/insurance/supervision-reports', { params })
  },

  /**
   * 生成监管报告
   * @param {Object} reportData 报告数据
   */
  generateSupervisionReport(reportData) {
    return request.post('/insurance/supervision-reports/generate', reportData)
  },

  /**
   * 获取合规检查记录
   * @param {Object} params 查询参数
   */
  getComplianceChecks(params) {
    return request.get('/insurance/compliance-checks', { params })
  },

  /**
   * 执行合规检查
   * @param {Object} checkData 检查数据
   */
  performComplianceCheck(checkData) {
    return request.post('/insurance/compliance-checks', checkData)
  },

  /**
   * 获取保险代理人列表
   * @param {Object} params 查询参数
   */
  getInsuranceAgents(params) {
    return request.get('/insurance/agents', { params })
  },

  /**
   * 注册保险代理人
   * @param {Object} agentData 代理人数据
   */
  registerInsuranceAgent(agentData) {
    return request.post('/insurance/agents/register', agentData)
  },

  /**
   * 认证保险代理人
   * @param {number} id 代理人ID
   * @param {Object} certificationData 认证数据
   */
  certifyInsuranceAgent(id, certificationData) {
    return request.post(`/insurance/agents/${id}/certify`, certificationData)
  },

  /**
   * 获取保险公司列表
   * @param {Object} params 查询参数
   */
  getInsuranceCompanies(params) {
    return request.get('/insurance/companies', { params })
  },

  /**
   * 注册保险公司
   * @param {Object} companyData 公司数据
   */
  registerInsuranceCompany(companyData) {
    return request.post('/insurance/companies/register', companyData)
  },

  /**
   * 获取保险条款
   * @param {number} productId 产品ID
   */
  getInsuranceTerms(productId) {
    return request.get(`/insurance/products/${productId}/terms`)
  },

  /**
   * 更新保险条款
   * @param {number} productId 产品ID
   * @param {Object} termsData 条款数据
   */
  updateInsuranceTerms(productId, termsData) {
    return request.put(`/insurance/products/${productId}/terms`, termsData)
  },

  /**
   * 获取保险费率
   * @param {number} productId 产品ID
   */
  getInsuranceRates(productId) {
    return request.get(`/insurance/products/${productId}/rates`)
  },

  /**
   * 更新保险费率
   * @param {number} productId 产品ID
   * @param {Object} ratesData 费率数据
   */
  updateInsuranceRates(productId, ratesData) {
    return request.put(`/insurance/products/${productId}/rates`, ratesData)
  },

  /**
   * 获取再保险信息
   * @param {Object} params 查询参数
   */
  getReinsuranceInfo(params) {
    return request.get('/insurance/reinsurance', { params })
  },

  /**
   * 申请再保险
   * @param {Object} reinsuranceData 再保险数据
   */
  applyReinsurance(reinsuranceData) {
    return request.post('/insurance/reinsurance/apply', reinsuranceData)
  },

  /**
   * 获取保险欺诈检测记录
   * @param {Object} params 查询参数
   */
  getFraudDetectionRecords(params) {
    return request.get('/insurance/fraud-detection', { params })
  },

  /**
   * 执行欺诈检测
   * @param {Object} detectionData 检测数据
   */
  performFraudDetection(detectionData) {
    return request.post('/insurance/fraud-detection', detectionData)
  },

  /**
   * 获取保险投诉记录
   * @param {Object} params 查询参数
   */
  getInsuranceComplaints(params) {
    return request.get('/insurance/complaints', { params })
  },

  /**
   * 提交保险投诉
   * @param {Object} complaintData 投诉数据
   */
  submitInsuranceComplaint(complaintData) {
    return request.post('/insurance/complaints', complaintData)
  },

  /**
   * 处理保险投诉
   * @param {number} id 投诉ID
   * @param {Object} handleData 处理数据
   */
  handleInsuranceComplaint(id, handleData) {
    return request.post(`/insurance/complaints/${id}/handle`, handleData)
  }
}