import "@minecraft/server";
import { COMPANY_MOODS } from "./data";
declare module "@minecraft/server" {
  interface Entity {
    patience: number;
    patienceCooldown: number;
    patienceSubtractAmount: number;
    attack: number;
    irritability: number;
    doorTimer: number;
    mood: keyof typeof COMPANY_MOODS;
    interval: number;
    kills: number;
    sensitivity: number;
    maxKills: number;
    judgementSpeed: number;
    openingDoor: boolean;
    growl: number;
    growlCooldown: number;
  }

  interface Player {
    stamina: number;
    staminaLevel: number;
    energyLevel: number;
    uiScore: number;
    fear: number;
    insanity: number;
    fearCooldown: number;
    injuries: number;
    laziness: number;
    paranoia: number;
    profitability: number;
    state: string;
    isInteracting: boolean;
    causeOfDeath: string;
    spectateCooldown: number;

    hudDisplay: number;
    healthLevel: number;
    loadingUi: number;
    weightUi: number;
    visorHud: number;
    handsFull: number;
    timerIcon: number;
    middleText: number;
    toolTipText: number;
  }
}

export type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2
  ? A
  : B;

export type WritableKeys<T> = {
  [P in keyof T]-?: IfEquals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, P>;
}[keyof T];

export type ReadonlyKeys<T> = {
  [P in keyof T]-?: IfEquals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, never, P>;
}[keyof T];

export type PickProperties<T extends object> = {
  [K in keyof T as T[K] extends Function ? never : K]: T[K];
};
