import {EntityManager} from "./EntityManager";

interface Type<T> extends Function {
    new(...args: any[]): T;
}

export class System<A, B = any, C = any, D = any, E = any> {
    constructor()

    readonly dependencies: Type<any>[]

    protected readonly entityManager: EntityManager

    startup(em: EntityManager): Promise<void>

    shutdown(em: EntityManager): Promise<void>

    link(a: A, entity: number): void
    link(a: A, b: B, entity: number): void
    link(a: A, b: B, c: C, entity: number): void
    link(a: A, b: B, c: C, d: D, entity: number): void
    link(a: A, b: B, c: C, d: D, e: E, entity: number): void

    unlink(a: A, entity: number): void
    unlink(a: A, b: B, entity: number): void
    unlink(a: A, b: B, c: C, entity: number): void
    unlink(a: A, b: B, c: C, d: D, entity: number): void
    unlink(a: A, b: B, c: C, d: D, e: E, entity: number): void

    update(time_delta: number): void

    fixedUpdate(time_delta: number): void
}
