import axiosInstance from '../../utils/axios';
import { PageParam, PageResponse } from '../user';

// 短信日志VO
export interface SmsLogVO {
  id: number;
  userId?: number;
  userType?: number;
  mobile: string;
  nickname?: string;
  channelId?: number;
  channelCode?: string;
  templateId?: number;
  templateCode?: string;
  templateContent?: string;
  templateType?: number;
  templateParams?: any;
  apiTemplateId?: string;
  apiSerialNo?: string;
  apiRequestId?: string;
  apiSendCode?: string;
  apiSendMsg?: string;
  apiReceiveCode?: string | null;
  apiReceiveMsg?: string | null;
  sendStatus?: number;
  receiveStatus?: number;
  sendTime?: number | string;
  receiveTime?: number | string | null;
  createTime?: number | string;
}

// 短信日志查询参数
export interface SmsLogQueryParams extends PageParam {
  channelId?: number;
  templateId?: number;
  mobile?: string;
  sendStatus?: number;
  receiveStatus?: number;
}

// 短信日志 API
export const smsLogApi = {
  // 获取短信日志列表（分页）
  getSmsLogPage: (params?: SmsLogQueryParams): Promise<PageResponse<SmsLogVO>> => {
    return axiosInstance.get('/system/sms-log/page', { params });
  },

  // 获取短信日志详情
  getSmsLog: (id: number): Promise<SmsLogVO> => {
    return axiosInstance.get(`/system/sms-log/get?id=${id}`);
  },
};

