import * as VScript from "http://172.16.0.12/bladerunner_sdk/vscript@2.5.2/deno/release/mod.ts";
import * as VAPI from "./mod.ts";
export const lift = {
  All: (_raw: VScript.DataViews.Subtree<VScript.VSocket>) => new All(_raw),
  Generator: (_raw: VScript.DataViews.Subtree<VScript.VSocket>) =>
    new Generator(_raw),
} as const;
export const lower = {
  All: (_x: All) => _x.raw.kwl,
  Generator: (_x: Generator) => _x.raw.kwl,
} as const;
export class All implements VScript.Referenceable<"ClosXBar::Data::All"> {
  readonly type_identifier = "ClosXBar::Data::All" as const;
  constructor(readonly raw: VScript.DataViews.Subtree<VScript.VSocket>) {}
  get start_generator() {
    return new VScript.StronglyTypedTable<
      VScript.VSocket,
      "ClosXBar::Data::Generator",
      VAPI.ClosXBar.Generator
    >(
      VScript.VAPIHelpers.subtree_table_child_checked(
        this.raw,
        0,
        "start_generator",
      ),
      (raw: VScript.DataViews.Subtree<VScript.VSocket>, _: VScript.VSocket) =>
        VAPI.ClosXBar.lift.Generator(raw),
    );
  }
}
export class Generator
  implements VScript.Referenceable<"ClosXBar::Data::Generator">
{
  readonly type_identifier = "ClosXBar::Data::Generator" as const;
  constructor(readonly raw: VScript.DataViews.Subtree<VScript.VSocket>) {}
  get used_config(): VScript.rKeyword<
    VScript.VSocket,
    null | number,
    null | VAPI.Primitives.Unsigned32,
    VAPI.ClosXBar.Generator
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      null | number,
      null | VAPI.Primitives.Unsigned32,
      VAPI.ClosXBar.Generator
    >(this, "used_config" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }

  /**
    time to write into the hardware. At this pointer the hardware gets
    informed to perform the switch
  */
  get write_hw(): VScript.rKeyword<
    VScript.VSocket,
    null | number,
    null | VScript.Duration,
    VAPI.ClosXBar.Generator
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      null | number,
      null | VScript.Duration,
      VAPI.ClosXBar.Generator
    >(this, "write_hw" as VScript.SysName, {
      lift: VScript.VAPIHelpers.liftOrLowerNullable(
        VScript.VAPIHelpers.liftNanoseconds,
      ),
      lower: VScript.VAPIHelpers.liftOrLowerNullable(
        VScript.VAPIHelpers.lowerNanoseconds,
      ),
    });
  }

  /**
    switching time
  */
  get calculated_sw_time(): VScript.rKeyword<
    VScript.VSocket,
    null | number,
    null | VScript.Duration,
    VAPI.ClosXBar.Generator
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      null | number,
      null | VScript.Duration,
      VAPI.ClosXBar.Generator
    >(this, "calculated_sw_time" as VScript.SysName, {
      lift: VScript.VAPIHelpers.liftOrLowerNullable(
        VScript.VAPIHelpers.liftNanoseconds,
      ),
      lower: VScript.VAPIHelpers.liftOrLowerNullable(
        VScript.VAPIHelpers.lowerNanoseconds,
      ),
    });
  }

  /**
    switching time
  */
  get interrupt_sw_time(): VScript.rKeyword<
    VScript.VSocket,
    null | number,
    null | VScript.Duration,
    VAPI.ClosXBar.Generator
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      null | number,
      null | VScript.Duration,
      VAPI.ClosXBar.Generator
    >(this, "interrupt_sw_time" as VScript.SysName, {
      lift: VScript.VAPIHelpers.liftOrLowerNullable(
        VScript.VAPIHelpers.liftNanoseconds,
      ),
      lower: VScript.VAPIHelpers.liftOrLowerNullable(
        VScript.VAPIHelpers.lowerNanoseconds,
      ),
    });
  }

  /**
    difference between calculated and interrupt time
  */
  get delta_calc_irq(): VScript.rKeyword<
    VScript.VSocket,
    null | number,
    null | VScript.Duration,
    VAPI.ClosXBar.Generator
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      null | number,
      null | VScript.Duration,
      VAPI.ClosXBar.Generator
    >(this, "delta_calc_irq" as VScript.SysName, {
      lift: VScript.VAPIHelpers.liftOrLowerNullable(
        VScript.VAPIHelpers.liftNanoseconds,
      ),
      lower: VScript.VAPIHelpers.liftOrLowerNullable(
        VScript.VAPIHelpers.lowerNanoseconds,
      ),
    });
  }

  /**
    difference between write hardware and interrupt time
  */
  get delta_write_hw_irq(): VScript.rKeyword<
    VScript.VSocket,
    null | number,
    null | VScript.Duration,
    VAPI.ClosXBar.Generator
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      null | number,
      null | VScript.Duration,
      VAPI.ClosXBar.Generator
    >(this, "delta_write_hw_irq" as VScript.SysName, {
      lift: VScript.VAPIHelpers.liftOrLowerNullable(
        VScript.VAPIHelpers.liftNanoseconds,
      ),
      lower: VScript.VAPIHelpers.liftOrLowerNullable(
        VScript.VAPIHelpers.lowerNanoseconds,
      ),
    });
  }
}
