import * as Study from "./study";
import * as User from "./user";
import * as News from "./news";
import * as Transfer from "./transfer";
import * as System from './system';
import * as Pay from "./pay";
import { VipCardInfo } from "./user";
import { EnumExamMode, EnumExamType, EnumReviewMode } from "@/common/enum";

/// 接口响应
export interface ApiResponse<T> {
  code: number;
  msg: string;
  data: T;
  card?: VipCardInfo;
  // 以下是注册登录才有的
  token?: string;
  user?: User.UserInfo;
  isDefaultModifyPwd?: boolean;
  isPasswordExpired?: boolean;
  // 以下是机构信息
  org?: {
    contactPhone: string;
    logo: string;
    orgName: string;
  }
}

export interface ApiCaptchaResponse {
  code: number;
  msg: string;
  img: string;
  uuid: string;
}

export interface ApiResponseList<T> {
  code: number;
  msg: string;
  rows: T[];
  total: number;
}

export interface TreeData {
  name: string;
  value: number;
  children?: TreeData[];
  isExpanded?: boolean;
  isLeaf?: boolean;
}

export interface TableConfig {
  border?: boolean;
  stripe?: boolean;
  emptyText?: string;
  loading?: boolean;
  rowKey?: string;
}

export interface TableColumnConfig {
  prop: string;
  label: string;
  flex?: number;
  slot?: string;
  type?: string;
  headerAlign?: 'left' | 'center' | 'right';
  align?: 'left' | 'center' | 'right';
}

/**
 * 应用 store
 */
export interface AppStoreState {
  isInitialized: boolean;
  activeTabbar: number;
  statusBarHeight: number;
  sysInfo: UniApp.GetSystemInfoResult | null;
  appConfig: ConfigItem[];
}

export interface DictStoreState {
  dicts: Record<string, DictItem[]>;
}

export interface UserStoreState {
  accessToken: string | null;
  user: User.UserInfo | null;
  isDefaultModifyPwd?: boolean;
  isPasswordExpired?: boolean;
  card: VipCardInfo | null;
  isExamGuideShow: boolean;
  tempInfo?: {
    location: string;
    examType?: EnumExamType;
  };
  org: {
    contactPhone: string;
    logo: string;
    orgName: string;
  };
  rememberPwd: boolean;
  cardPassword: string;
  cardNo: string;
  directedSchoolList: Study.DirectedSchool[];
  practiceSettings: Study.PracticeSettings;
}

/**
 * 字典项
 */
export interface DictItem {
  dictLabel: string;
  dictValue: string;
}

export interface PickerItem {
  label: string;
  value: string | number;
}

export interface ConfigItem {
  configKey: string;
  configValue: string;
  configType: string;
  configName: string;
  configId: number;
}



export { Study, User, News, Transfer, System, Pay };