/**
 * Namespace Api
 *
 * All backend api type
 */
declare namespace Api {
  namespace Rank {
    /** common params of paginating */
    interface PaginatingCommonParams {
      /** currentPage page number */
      currentPage: number
      /** page pageSize */
      pageSize: number
      /** total count */
      total?: number
    }

    /** user search params */
    interface UserSearchParams extends PaginatingCommonParams {
      /** competition activity name */
      competitionActivityName?: string
      /** publish status */
      publishStatus?: EnableStatus
    }

    /** common params of paginating query list data */
    interface PaginatingQueryRecord<T = any> extends PaginatingCommonParams {
      records: T[]
    }

    /** common search params of table */
    type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'currentPage' | 'pageSize'>

    interface ActivityRankResList extends Array<ActivityRankItem> {}

    interface ActivityRankItem {
      TeamID: number
      Name: string
      TotalPoint: number
      Questions: QuestionScore[]
    }

    interface QuestionScore {
      QuestionNO: number
      ResultPotin: number
    }

    interface ActivityRankList {
      Items: ActivityRank[]
      TotalRecords: number
      PageNumber: number
      PageSize: number
      TotalPages: number
    }

    interface UpdateTeamScoreParams {
      /** 主活动 ID */
      ActivityID: number

      Id: number
      /** 结果得分 */
      ResultPotins: number
    }

    /** activity rank */
    interface ActivityRank {
      /** activity id */
      Id: number
      /** activity id (MainID) */
      ActivityId: number
      /** activity name */
      ActivityName: string
      /** start time */
      StartTime: string
      /** team number */
      TeamNum: number
      /** max point */
      MaxPoint: number
      /** last update time */
      LastUpdatetime: string
      /** is publish */
      Status: number
    }

    /**
     * enable status
     *
     * - "1": enabled
     * - "2": disabled
     */
    type EnableStatus = '1' | '2'

    /** question score type */
    type QuestionScoreType = '1' | '2' /** 固定分数 | 答题个数 */

    /** competition round type */
    type CompetitionRoundType = '1' | '2' /** 题包环节 | 加时环节 */

    /** common record */
    type CommonRecord<T = any> = {
      /** record id */
      id: number
      /** record creator */
      createBy: string
      /** record create time */
      createTime: string
      /** record updater */
      updateBy: string
      /** record update time */
      updateTime: string
      /** record status */
      status: EnableStatus | null
    } & T
  }
}
