/// <reference path="./types/index.d.ts" />

export interface VoteOption {
  id: number;
  name: string;
  votes: number;
  is_voted: boolean;
  percentage?: number;
  isSelected?: boolean;
}

export interface CardData {
  article_id: number;
  article_title: string;
  vote_type: 'single' | 'multiple';
  total_voters: number;
  end_time: string;
  is_ended: boolean;
  publisher_id: string;
  create_time: string;
  options: VoteOption[];
  user_has_voted: boolean;
  user_voted_option_ids: number[] | null;
}




interface IAppOption {
  globalData: {
    userInfo?: WechatMiniprogram.CustomUserInfo | null,
    token: string,
    rawCardData:CardData[],
    processedCardsData:CardData[]
  }
  userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback,
  processVoteData(rawData: CardData[]): CardData[],
  fetchRawCardData():void,
}