// eslint-disable-next-line no-shadow
export enum Privileges {
  None = -1,
  SuperUser,
  AdminPlus,
  Admin
}

export interface Contribution {
  createdAt: string;
  amount: number;
  rewardFundID: number;
  transactionID: string;
  wallet: string;
}

interface Contributions {
  list: Contribution[];
  dates: string[];
  total: number;
}

export interface RewardFund {
  id: number;
  asset: string;
  wallet: string;
  memo: string;
  amountGoal: number;
  minContribution: number;
  contributions: Contribution[] | null;
  title: string;
  description: string;
}

export interface Queue {
  id: number;
  name: string;
}

export interface CreateQueueRequest {
  name: string;
}

export interface CreateQueueResponse {
  id: number;
}

export interface GetQueuesResponse {
  queues: Queue[];
}

export interface SuccessResponse {
  success: boolean;
}

export interface GetRewardFundRequest {
  id: number;
  consolidateContributions: boolean;
}

export interface Bonus {
  goal?: number;
  percent?: number;
}

export interface CreateRewardFundRequest {
  asset: string;
  fundWallet: string;
  sellingWallet: string;
  issuerWallet: string;
  memo: string;
  minContribution: number;
  title: string;
  description: string;
  queueID?: number | null;
  bonuses: Bonus[];
}

export interface FundInfo {
  id: number;
  asset: string;
  fundWallet: string;
  sellingWallet: string;
  issuerWallet: string;
  memo: string;
  price: number;
  amountAvailable: number;
  amountGoal: number;
  minContribution: number;
  title: string;
  description: string;
  bonuses: Bonus[];
  queueID: number | null;
}

interface Total {
  amountHeld: number;
}

export interface GetRewardFundResponse {
  fundInfo: FundInfo;
  contributions: Contributions;
  total: Total;
}

export interface GetBalanceRequest {
  secretKey: string;
}

export interface GetBalanceResponse {
  balance: number;
}

export interface ContributeRequest {
  privateKey: string;
  amount: number;
  rewardFund: number;
}

export interface AuthenticationRequest {
  username: string;
  password: string;
}

export interface LoginResponse {
  token: string | null;
}

export interface GetQueueMembersRequest {
  id: number;
}

export interface GetQueueMembersResponse {
  members: RewardFund[];
}

export interface GetRewardFundsRequest {
  offset: number;
}

export interface GetRewardFundsResponse {
  rewardFunds: FundInfo[];
  total: number;
}

export interface Claims {
  username: string;
  privileges: Privileges;
  exp: number;
}

export interface GetContributionsRequest {
  id: number;
  offset: number;
  forDate: string | undefined;
  consolidateContributions: boolean;
}

export type GetContributionsResponse = Contributions;

export interface CloseRewardFundRequest {
  id: number;
  close: boolean;
}
