import type { SocketMessage as BaseSocketMessage, SocketMessageType } from '@d8d-appcontainer/types';

// 基础答题记录
export interface AnswerRecord {
  date: string;
  price: string;
  holdingStock: string;
  holdingCash: string;
  profitAmount: number;
  profitPercent: number;
  index: number;
}

// 答题内容
export interface QuizContent {
  date: string;
  price: number | string;
  holdingStock: string;
  holdingCash: string;
  userId: string;
}

// 题目状态
export interface QuizState {
  date: string;
  price: number | string;
}

export type ExamSocketMessageType = SocketMessageType | 'question' | 'answer' | 'settlement' | 'submit' | 'restart';

// Socket消息
export interface ExamSocketMessage extends Omit<BaseSocketMessage, 'type' | 'content'> {
  type: ExamSocketMessageType;
  content: QuizContent;
}

// Socket房间消息
export interface ExamSocketRoomMessage {
  roomId: string;
  message: ExamSocketMessage;
}

// 答案
export interface Answer extends QuizContent {
  userId: string;
  profitAmount?: number;
  profitPercent?: number;
  totalProfitAmount?: number;
  totalProfitPercent?: number;
}

// 教室数据
export interface ClassroomData {
  classroom_no: string;
  status: string;
  training_date: string;
  code: string;
}

// 累计结果
export interface CumulativeResult {
  userId: string;
  totalProfitAmount: number;
  totalProfitPercent: number;
} 