import { requestClient } from '#/api/request';
import type { friendRecord } from '#/model/type';

export interface UserData {
  data: object[];
  total: number;
  sum: number;
  psum: number;
  nsum: number;
}
export interface UserLogAssetParam {
  Id: number;
  Event?: string;
  StartTime?: number;
  EndTime?: number;
  ItemId?: number;
  PageSize?: number;
  CurrentPage?: number;
  AppId?: number;
  Node?: number;
}
export interface UserLogOrder {
  Id: number;
  Time: number;
  Type: number;
  Diff: number;
  ChessId: ChessType[];
}

export interface ChessType {
  Id: string;
  Icon: string;
}
export interface heatType {
  date: string;
  value: number;
}
export interface UserLogInfo {
  AreaId: number;
  Charge: number;
  Level: number;
  Name: string;
  Star: number;
  Login: number;
  Energy: number;
  Diamond: number;
  Mac: string;
  Cumulative: number;
  TodayCumulative: number;
  Bonus?: number;
  Code?: string;
  RegisterTime: number;
  Ban?: number;
  Face?:number;
  Order: UserLogOrder[];
  ChessMap?:string;
  Heatmap?: heatType[];
  ActLog?:actlog[];
  MaxCharge?: number;
  FriendList?: friendRecord[];
}

export interface actlog {
 Time: number;
  Type: number;
  Param: string;
}

export interface UserOrder {
  Id: number;
  OrderId: number;
  Price: number;
  PayChannelOrderId: number;
  ProductId: number;
  CreateTime: number;
  PayTime: number;
  PayType: number;
  Param: string;
  CreateTimeStr?: string;
  PayTimeStr?: string;
  PayStatus?:number;
}

export async function getUserLogAssetApi(data: UserLogAssetParam) {
  return requestClient.post<UserData>('/log/asset', data);
}

export async function getUserlogEventApi(data: UserLogAssetParam) {
  return requestClient.post<UserData>('/log/event', data);
}

export async function getUserlogInfoApi(data: UserLogAssetParam) {
  return requestClient.post<UserLogInfo>('/log/user', data);
}

export async function getUserlogOrderApi(data: UserLogAssetParam) {
  return requestClient.post<UserOrder>('/log/order', data);
}
