export type User = {
  id: number;
  inventoryItems: IInventoryItem[];
};

export interface TimeDuration {
  hours: number;
  minutes: number;
  seconds: number;
}

export interface IResourceWell {
  id: string;
  resourceType: string;
  supply: number;
}

export interface IStake {
  id: number;
  resourceType: string;
  stakingSourceId: number;
  startTime: string;
  inventoryItemId: string;
  stakeAmount: number;
  durationInMins: number;
  unclaimed: boolean | undefined;
  claimable: boolean | undefined
  remainingTime: number | undefined
}

export interface IStakingSource {
  id: number;
  name: string;
  description: string;
  resourceWells: IResourceWell[];
  activeStakes: IStake[];
  image: string | null
  price: number | null
  resourceChance: number | null
  resourceMinStartAmount: number | null
  resourceMaxStartAmount: number | null
  size: number | undefined
}

export interface IInventoryItem {
  currentTierIndex: number;
  id: string;
  storeItem: IStoreItem;
  storeItemId: number
}

export interface IUpgrade {
    tier: number;
    price: number;
    claimBoost: number;
}

export interface IStoreItem {
  id: number;
  name: string;
  description: string;
  image: string,
  price: number;
  completionTimeInMins: number;
  claimAmount: number;
  upgrades: IUpgrade[];
  isOwned: boolean;
}

export interface IResourceAccount {
  id: number;
  resourceType: string;
  balance: number;
}

export interface IBankAccount {
  id: number;
  primaryBalance: number;
  resourceAccounts: IResourceAccount[];
}

export interface IGameConfig {
  resources: string[];
  [key: string]: any;
  store: IStoreItem[];
  gameConstants: {[key: string]: any;}
}

export interface IConversionPair {
  resourceType: string;
  resourceAmount: number;
  moneyAmount: number
}

interface Notification {
  message: string;
  type: string;
}

interface NotificationPopoverProps {
  notification: Notification;
  onClose: () => void;
}

// Phantom
export interface PhantomProvider {
  publicKey: PublicKey | null;
  isConnected: boolean | null;
  signAndSendTransaction: (
    transaction: Transaction,
    opts?: SendOptions
  ) => Promise<{ signature: string; publicKey: PublicKey }>;
  signTransaction: (transaction: Transaction) => Promise<Transaction>;
  signAllTransactions: (transactions: Transaction[]) => Promise<Transaction[]>;
  signMessage: (
    message: Uint8Array | string,
    display?: DisplayEncoding
  ) => Promise<any>;
  connect: (opts?: Partial<ConnectOpts>) => Promise<{ publicKey: PublicKey }>;
  disconnect: () => Promise<void>;
  on: (event: PhantomEvent, handler: (args: any) => void) => void;
  request: (method: PhantomRequestMethod, params: any) => Promise<unknown>;
}

type DisplayEncoding = "utf8" | "hex";

interface ConnectOpts {
  onlyIfTrusted: boolean;
}

type PhantomEvent = "connect" | "disconnect" | "accountChanged";

type PhantomRequestMethod =
  | "connect"
  | "disconnect"
  | "signAndSendTransaction"
  | "signTransaction"
  | "signAllTransactions"
  | "signMessage";


  // Generic stuff

export interface IOption {
    value: string,
    label: string
}

export interface ISelectDropdownProps {
    options: IOption[];
    onChange?: (value: string) => void;
    isActive: boolean
}

export interface IChart {
  label: string
  labels: string[]
  values: number[]
}
