0.1.5Updated 6 months ago
// deno-lint-ignore-file ban-types

import { Entity, run_on_worker } from "@infinity-beyond/classes/data_types/entity/entity.ts";
import { SupplyPermissions } from "@supply/supply.permissions.ts";
import { SupplyRest } from "@supply/supply.rest.ts";
import { SupplyMeta } from "@supply/supply.meta.ts";

export class Supply<
  EntityName extends string,
  PEMC extends Entity.Meta.Config = {},
> extends Entity<
  Supply.Events,
  EntityName,
  Supply.Permissions<EntityName>,
  Supply.Meta,
  PEMC,
  Supply.Options<PEMC>
> {
  override readonly REST = new SupplyRest(this);

  protected static override Permissions: readonly string[] = SupplyPermissions;

  constructor(name: EntityName, options: Supply.Options<PEMC> = {}) {
    super(name, options, SupplyMeta as Supply.Meta);
  }

  @run_on_worker
  async AddItem(item: Supply.Item.Unentered) {
    item; // TODO
  }
}