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 = {
  SlaveSettings: (_raw: VScript.DataViews.Subtree<VScript.VSocket>) =>
    new SlaveSettings(_raw),
  AllGeneralSettings: (_raw: VScript.DataViews.Subtree<VScript.VSocket>) =>
    new AllGeneralSettings(_raw),
  MasterSettingsGrandmaster: (
    _raw: VScript.DataViews.Subtree<VScript.VSocket>,
  ) => new MasterSettingsGrandmaster(_raw),
  AgentSlaveStatisticsInstantaneousEstimate: (
    _raw: [
      VAPI.PTPFlows.MeasurementFamily,
      number | string,
      number | string,
      boolean,
    ],
    _socket: VScript.VSocket,
  ): AgentSlaveStatisticsInstantaneousEstimate => {
    return {
      type: _raw[0],
      slave_time: VScript.VAPIHelpers.liftTimestamp(_raw[1], _socket),
      master_time: VScript.VAPIHelpers.liftTimestamp(_raw[2], _socket),
      accepted: _raw[3],
    };
  },
  AgentMasterStatistics: (_raw: VScript.DataViews.Subtree<VScript.VSocket>) =>
    new AgentMasterStatistics(_raw),
  AgentSlaveStatisticsOneWayDelay: (
    _raw: [number, number],
    _socket: VScript.VSocket,
  ): AgentSlaveStatisticsOneWayDelay => {
    return {
      mean: VScript.VAPIHelpers.liftSeconds(_raw[0], _socket),
      error: VScript.VAPIHelpers.liftSeconds(_raw[1], _socket),
    };
  },
  AgentSlaveStatistics: (_raw: VScript.DataViews.Subtree<VScript.VSocket>) =>
    new AgentSlaveStatistics(_raw),
} as const;
export const lower = {
  SlaveSettings: (_x: SlaveSettings) => _x.raw.kwl,
  AllGeneralSettings: (_x: AllGeneralSettings) => _x.raw.kwl,
  MasterSettingsGrandmaster: (_x: MasterSettingsGrandmaster) => _x.raw.kwl,
  AgentSlaveStatisticsInstantaneousEstimate: (
    _x: {
      type: VAPI.PTPFlows.MeasurementFamily;
      slave_time: VAPI.Primitives.Timestamp;
      master_time: VAPI.Primitives.Timestamp;
      accepted: boolean;
    },
    _socket: VScript.VSocket,
  ): [
    VAPI.PTPFlows.MeasurementFamily,
    number | string,
    number | string,
    boolean,
  ] => [
    _x.type,
    VScript.VAPIHelpers.lowerTimestamp(_x.slave_time, _socket),
    VScript.VAPIHelpers.lowerTimestamp(_x.master_time, _socket),
    _x.accepted,
  ],
  AgentMasterStatistics: (_x: AgentMasterStatistics) => _x.raw.kwl,
  AgentSlaveStatisticsOneWayDelay: (
    _x: { mean: VScript.Duration; error: VScript.Duration },
    _socket: VScript.VSocket,
  ): [number, number] => [
    VScript.VAPIHelpers.lowerSeconds(_x.mean, _socket),
    VScript.VAPIHelpers.lowerSeconds(_x.error, _socket),
  ],
  AgentSlaveStatistics: (_x: AgentSlaveStatistics) => _x.raw.kwl,
} as const;
export type DiffServCodePoint = number;
export type Log2Interval = number;
export type MeasurementFamily = "SyncFollowUp" | "DelayRespReq";
export type MessageClass = "Event" | "General";
export type MessageType =
  | "Sync"
  | "Delay_Req"
  | "Pdelay_Req"
  | "Pdelay_Resp"
  | "Follow_Up"
  | "Delay_Resp"
  | "Pdelay_Resp_Follow_Up"
  | "Announce"
  | "Signaling"
  | "Management"
  | "Invalid";
export type Nibble = number;
export type QualityAssessment = "Convergent" | "Normal" | "Divergent" | "None";
export type Routing = "Unicast" | "Multicast";
export type SequenceNumber = VAPI.Primitives.Unsigned16;
export class SlaveSettings
  implements VScript.Referenceable<"PTPFlows::Data::SlaveSettings">
{
  readonly type_identifier = "PTPFlows::Data::SlaveSettings" as const;
  constructor(readonly raw: VScript.DataViews.Subtree<VScript.VSocket>) {}

  /**
    base-2 logarithm of the delay request interval in seconds. E.g., a
    setting of -3 will cause this agent to emit delay requests 8 times a
    second; 4 times a second if this is set to -2. Delay request intervals
    may not be shorter than the minimum delay request interval set by the
    currently active master.
  */
  get log2_delayreq_interval(): VScript.dKeyword<
    VScript.VSocket,
    number,
    number,
    VAPI.PTPFlows.Log2Interval,
    VAPI.PTPFlows.Log2Interval,
    VAPI.PTPFlows.SlaveSettings
  > {
    return new VScript.dKeyword<
      VScript.VSocket,
      number,
      number,
      VAPI.PTPFlows.Log2Interval,
      VAPI.PTPFlows.Log2Interval,
      VAPI.PTPFlows.SlaveSettings
    >(
      this,
      "log2_delayreq_interval" as VScript.SysName,
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      null,
    );
  }
  get log2_master_sync_interval(): VScript.rKeyword<
    VScript.VSocket,
    null | number,
    null | number,
    VAPI.PTPFlows.SlaveSettings
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      null | number,
      null | number,
      VAPI.PTPFlows.SlaveSettings
    >(this, "log2_master_sync_interval" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }

  /**
    minimum delay request interval as set by the most recently received delay
    response message
  */
  get relative_min_log2_delayreq_interval(): VScript.rKeyword<
    VScript.VSocket,
    null | number,
    null | number,
    VAPI.PTPFlows.SlaveSettings
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      null | number,
      null | number,
      VAPI.PTPFlows.SlaveSettings
    >(this, "relative_min_log2_delayreq_interval" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }

  /**
    unlike sync and follow-up messages, which contain no client-dependent
    information and are thus useful to all clients within their PTP domain,
    delay request/response messages are useful only to the inquiring client
    (and perhaps to the master if it wishes to monitor its clients' timing
    properties). Exchanging these messages via unicast reduces both network
    traffic and local workload but yields otherwise identical results (this
    mode may also be called `Hybrid` on other products). If
    `delay_req_routing` is set to `Multicast`, this optimization is disabled
    and all delay requests emitted by this agent will be sent to the PTP
    multicast event address `224.0.1.129:319`
  */
  get delay_req_routing(): VScript.dKeyword<
    VScript.VSocket,
    VAPI.PTPFlows.Routing,
    VAPI.PTPFlows.Routing,
    VAPI.PTPFlows.Routing,
    VAPI.PTPFlows.Routing,
    VAPI.PTPFlows.SlaveSettings
  > {
    return new VScript.dKeyword<
      VScript.VSocket,
      VAPI.PTPFlows.Routing,
      VAPI.PTPFlows.Routing,
      VAPI.PTPFlows.Routing,
      VAPI.PTPFlows.Routing,
      VAPI.PTPFlows.SlaveSettings
    >(
      this,
      "delay_req_routing" as VScript.SysName,
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      null,
    );
  }
}
export type Version = VAPI.PTPFlows.Nibble;
/**
  if `best_master_selection` is set to `Eager`, an incoming Announce message
  will immediately register its sender as the currently accepted PTP master
  if all previously registered masters are deemed inferior by the BMC
  algorithm. Conversely, if `Cautious` is selected, and if the PTPClock is
  currently calibrated, a previously selected PTP master will be retained
  until it times out
*/
export type AllGeneralSettingsBestMasterSelection = "Eager" | "Cautious";
export type MasterSettingsDelayDecimationFactor = number;
export class AllGeneralSettings
  implements VScript.Referenceable<"PTPFlows::Data::All::GeneralSettings">
{
  readonly type_identifier = "PTPFlows::Data::All::GeneralSettings" as const;
  constructor(readonly raw: VScript.DataViews.Subtree<VScript.VSocket>) {}

  /**
    remove visible masters if the time elapsed since their last Announce
    message exceeds `master_timeout`
  */
  get master_timeout(): VScript.dKeyword<
    VScript.VSocket,
    number,
    number,
    VScript.Duration,
    VScript.Duration,
    VAPI.PTPFlows.AllGeneralSettings
  > {
    return new VScript.dKeyword<
      VScript.VSocket,
      number,
      number,
      VScript.Duration,
      VScript.Duration,
      VAPI.PTPFlows.AllGeneralSettings
    >(
      this,
      "master_timeout" as VScript.SysName,
      {
        lift: VScript.VAPIHelpers.liftNanoseconds,
        lower: VScript.VAPIHelpers.lowerNanoseconds,
      },
      {
        lift: VScript.VAPIHelpers.liftNanoseconds,
        lower: VScript.VAPIHelpers.lowerNanoseconds,
      },
      null,
    );
  }

  /**
    if `best_master_selection` is set to `Eager`, an incoming Announce
    message will immediately register its sender as the currently accepted
    PTP master if all previously registered masters are deemed inferior by
    the BMC algorithm. Conversely, if `Cautious` is selected, and if the
    PTPClock is currently calibrated, a previously selected PTP master will
    be retained until it times out
  */
  get best_master_selection(): VScript.rwKeyword<
    VScript.VSocket,
    VAPI.PTPFlows.AllGeneralSettingsBestMasterSelection,
    VAPI.PTPFlows.AllGeneralSettingsBestMasterSelection,
    VAPI.PTPFlows.AllGeneralSettingsBestMasterSelection,
    VAPI.PTPFlows.AllGeneralSettingsBestMasterSelection,
    VAPI.PTPFlows.AllGeneralSettings
  > {
    return new VScript.rwKeyword<
      VScript.VSocket,
      VAPI.PTPFlows.AllGeneralSettingsBestMasterSelection,
      VAPI.PTPFlows.AllGeneralSettingsBestMasterSelection,
      VAPI.PTPFlows.AllGeneralSettingsBestMasterSelection,
      VAPI.PTPFlows.AllGeneralSettingsBestMasterSelection,
      VAPI.PTPFlows.AllGeneralSettings
    >(
      this,
      "best_master_selection" as VScript.SysName,
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      null,
    );
  }

  /**
    offload DelayResponse generation to hardware if supported by the
    currently active FPGA build
  */
  get hardware_offload(): VScript.dKeyword<
    VScript.VSocket,
    boolean,
    boolean,
    boolean,
    boolean,
    VAPI.PTPFlows.AllGeneralSettings
  > {
    return new VScript.dKeyword<
      VScript.VSocket,
      boolean,
      boolean,
      boolean,
      boolean,
      VAPI.PTPFlows.AllGeneralSettings
    >(
      this,
      "hardware_offload" as VScript.SysName,
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      null,
    );
  }

  /**
    if DelayResponse hardware offloading is available, delay requests will by
    default not be forwarded to the CPU. If you wish to do so to, e.g.,
    analyze incoming traffic using `tcpdump`, set this option to `false`
  */
  get absorb_delayrequests(): VScript.dKeyword<
    VScript.VSocket,
    boolean,
    boolean,
    boolean,
    boolean,
    VAPI.PTPFlows.AllGeneralSettings
  > {
    return new VScript.dKeyword<
      VScript.VSocket,
      boolean,
      boolean,
      boolean,
      boolean,
      VAPI.PTPFlows.AllGeneralSettings
    >(
      this,
      "absorb_delayrequests" as VScript.SysName,
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      null,
    );
  }
}
export class MasterSettingsGrandmaster
  implements
    VScript.Referenceable<"PTPFlows::Data::MasterSettings::Grandmaster">
{
  readonly type_identifier =
    "PTPFlows::Data::MasterSettings::Grandmaster" as const;
  constructor(readonly raw: VScript.DataViews.Subtree<VScript.VSocket>) {}

  /**
    this value will be used as `priority_1` if this agent is set to act as a
    PTP master
  */
  get priority_1(): VScript.dKeyword<
    VScript.VSocket,
    null | number,
    null | number,
    null | VAPI.Primitives.Unsigned8,
    null | VAPI.Primitives.Unsigned8,
    VAPI.PTPFlows.MasterSettingsGrandmaster
  > {
    return new VScript.dKeyword<
      VScript.VSocket,
      null | number,
      null | number,
      null | VAPI.Primitives.Unsigned8,
      null | VAPI.Primitives.Unsigned8,
      VAPI.PTPFlows.MasterSettingsGrandmaster
    >(
      this,
      "priority_1" as VScript.SysName,
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      null,
    );
  }

  /**
    this value will be used as `priority_2` if this agent is set to act as a
    PTP master
  */
  get priority_2(): VScript.dKeyword<
    VScript.VSocket,
    null | number,
    null | number,
    null | VAPI.Primitives.Unsigned8,
    null | VAPI.Primitives.Unsigned8,
    VAPI.PTPFlows.MasterSettingsGrandmaster
  > {
    return new VScript.dKeyword<
      VScript.VSocket,
      null | number,
      null | number,
      null | VAPI.Primitives.Unsigned8,
      null | VAPI.Primitives.Unsigned8,
      VAPI.PTPFlows.MasterSettingsGrandmaster
    >(
      this,
      "priority_2" as VScript.SysName,
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      null,
    );
  }

  /**
    this value will be used as `clock_quality` if this agent is set to act as
    a PTP master
  */
  get clock_quality(): VScript.dKeyword<
    VScript.VSocket,
    null | [VAPI.PTP.ClockClass, VAPI.PTP.ClockAccuracy, number],
    null | [VAPI.PTP.ClockClass, VAPI.PTP.ClockAccuracy, number],
    null | VAPI.PTP.ClockQuality,
    null | VAPI.PTP.ClockQuality,
    VAPI.PTPFlows.MasterSettingsGrandmaster
  > {
    return new VScript.dKeyword<
      VScript.VSocket,
      null | [VAPI.PTP.ClockClass, VAPI.PTP.ClockAccuracy, number],
      null | [VAPI.PTP.ClockClass, VAPI.PTP.ClockAccuracy, number],
      null | VAPI.PTP.ClockQuality,
      null | VAPI.PTP.ClockQuality,
      VAPI.PTPFlows.MasterSettingsGrandmaster
    >(
      this,
      "clock_quality" as VScript.SysName,
      {
        lift: VScript.VAPIHelpers.liftOrLowerNullable(
          VAPI.PTP.lift.ClockQuality,
        ),
        lower: VScript.VAPIHelpers.liftOrLowerNullable(
          VAPI.PTP.lower.ClockQuality,
        ),
      },
      {
        lift: VScript.VAPIHelpers.liftOrLowerNullable(
          VAPI.PTP.lift.ClockQuality,
        ),
        lower: VScript.VAPIHelpers.liftOrLowerNullable(
          VAPI.PTP.lower.ClockQuality,
        ),
      },
      null,
    );
  }

  /**
    ClockIdentity as defined by the PTP standard, stored in big-endian order.
  */
  get clock_identity(): VScript.rKeyword<
    VScript.VSocket,
    Array<number>,
    VAPI.PTP.ClockIdentity,
    VAPI.PTPFlows.MasterSettingsGrandmaster
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      Array<number>,
      VAPI.PTP.ClockIdentity,
      VAPI.PTPFlows.MasterSettingsGrandmaster
    >(this, "clock_identity" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }
}
export interface AgentSlaveStatisticsInstantaneousEstimate {
  type: VAPI.PTPFlows.MeasurementFamily;
  slave_time: VAPI.Primitives.Timestamp;
  master_time: VAPI.Primitives.Timestamp;
  accepted: boolean;
}
/**
  base-2 logarithm of the announce interval in seconds. E.g., a setting of -2
  will cause this agent to emit announce messages 4 times a second; 2 times a
  second if this is set to -1.
*/
export type MasterSettingsLog2AnnounceInterval = number;
/**
  base-2 logarithm of the sync interval in seconds. E.g., a setting of -3
  will cause this agent to emit sync and followup messages 8 times a second;
  4 times a second if this is set to -2.
*/
export type MasterSettingsLog2SyncInterval = number;
export class AgentMasterStatistics
  implements VScript.Referenceable<"PTPFlows::Data::Agent::MasterStatistics">
{
  readonly type_identifier = "PTPFlows::Data::Agent::MasterStatistics" as const;
  constructor(readonly raw: VScript.DataViews.Subtree<VScript.VSocket>) {}
  get num_announces_sent(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentMasterStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentMasterStatistics
    >(this, "num_announces_sent" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }
  get num_syncs_sent(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentMasterStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentMasterStatistics
    >(this, "num_syncs_sent" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }
  get num_followups_sent(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentMasterStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentMasterStatistics
    >(this, "num_followups_sent" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }
  get num_delayreqs_received(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentMasterStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentMasterStatistics
    >(this, "num_delayreqs_received" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }
  get num_delayresps_sent(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentMasterStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentMasterStatistics
    >(this, "num_delayresps_sent" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }
}
export type AgentMode = "SlaveOnly" | "MasterSlave" | "MasterOnly";
export interface AgentSlaveStatisticsOneWayDelay {
  mean: VScript.Duration;
  error: VScript.Duration;
}
export class AgentSlaveStatistics
  implements VScript.Referenceable<"PTPFlows::Data::Agent::SlaveStatistics">
{
  readonly type_identifier = "PTPFlows::Data::Agent::SlaveStatistics" as const;
  constructor(readonly raw: VScript.DataViews.Subtree<VScript.VSocket>) {}
  get num_syncs_received(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentSlaveStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentSlaveStatistics
    >(this, "num_syncs_received" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }
  get num_followups_received(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentSlaveStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentSlaveStatistics
    >(this, "num_followups_received" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }

  /**
    number of measurements performed on the basis of incoming sync/followup
    messages. May be smaller than the number of received sync messages due
    to, e.g., missing followup messages
  */
  get num_sync_measurements(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentSlaveStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentSlaveStatistics
    >(this, "num_sync_measurements" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }

  /**
    number of delay request messages handed off to the operating system. The
    actual number of transmitted messages may be lower in case of network
    configuration issues; check `num_delay_measurements` if you suspect this
    to be the case
  */
  get num_delayreqs_sent(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentSlaveStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentSlaveStatistics
    >(this, "num_delayreqs_sent" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }
  get num_delayresps_received(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentSlaveStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentSlaveStatistics
    >(this, "num_delayresps_received" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }

  /**
    number of delay response messages considered for further processing. May
    be smaller than the number of received delay response messages due to,
    e.g., mismatching requesting source port identities (especially when
    operating in multicast routing mode)
  */
  get num_delayresps_considered(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentSlaveStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentSlaveStatistics
    >(this, "num_delayresps_considered" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }

  /**
    number of delay response messages that were considered for processing,
    but later discarded for other reasons
  */
  get num_delayresps_discarded(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentSlaveStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentSlaveStatistics
    >(this, "num_delayresps_discarded" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }

  /**
    number of measurements performed on the basis of delay request/response
    messages. May be both smaller than the number of dispatched delay request
    messages (perhaps due to network configuration issues), and smaller than
    the number of received delay response messages (especially when operating
    in multicast routing mode, where most incoming delay response messages
    are typically intended for other PTP clients)
  */
  get num_delay_measurements(): VScript.rKeyword<
    VScript.VSocket,
    number,
    VAPI.Primitives.CyclicCounter32,
    VAPI.PTPFlows.AgentSlaveStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      number,
      VAPI.Primitives.CyclicCounter32,
      VAPI.PTPFlows.AgentSlaveStatistics
    >(this, "num_delay_measurements" as VScript.SysName, {
      lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
      lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
    });
  }
  get one_way_delay(): VScript.rKeyword<
    VScript.VSocket,
    null | [number, number],
    null | VAPI.PTPFlows.AgentSlaveStatisticsOneWayDelay,
    VAPI.PTPFlows.AgentSlaveStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      null | [number, number],
      null | VAPI.PTPFlows.AgentSlaveStatisticsOneWayDelay,
      VAPI.PTPFlows.AgentSlaveStatistics
    >(this, "one_way_delay" as VScript.SysName, {
      lift: VScript.VAPIHelpers.liftOrLowerNullable(
        VAPI.PTPFlows.lift.AgentSlaveStatisticsOneWayDelay,
      ),
      lower: VScript.VAPIHelpers.liftOrLowerNullable(
        VAPI.PTPFlows.lower.AgentSlaveStatisticsOneWayDelay,
      ),
    });
  }
  get estimated_jitter(): VScript.rKeyword<
    VScript.VSocket,
    null | number,
    null | VScript.Duration,
    VAPI.PTPFlows.AgentSlaveStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      null | number,
      null | VScript.Duration,
      VAPI.PTPFlows.AgentSlaveStatistics
    >(this, "estimated_jitter" as VScript.SysName, {
      lift: VScript.VAPIHelpers.liftOrLowerNullable(
        VScript.VAPIHelpers.liftSeconds,
      ),
      lower: VScript.VAPIHelpers.liftOrLowerNullable(
        VScript.VAPIHelpers.lowerSeconds,
      ),
    });
  }
  get publish_instantaneous_estimates(): VScript.rwKeyword<
    VScript.VSocket,
    boolean,
    boolean,
    boolean,
    boolean,
    VAPI.PTPFlows.AgentSlaveStatistics
  > {
    return new VScript.rwKeyword<
      VScript.VSocket,
      boolean,
      boolean,
      boolean,
      boolean,
      VAPI.PTPFlows.AgentSlaveStatistics
    >(
      this,
      "publish_instantaneous_estimates" as VScript.SysName,
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      {
        lift: (x: any /* FIXME */, _: VScript.VSocket) => x,
        lower: (x: any /* FIXME */, _: VScript.VSocket) => x,
      },
      null,
    );
  }
  get instantaneous_estimate(): VScript.rKeyword<
    VScript.VSocket,
    | null
    | [
        VAPI.PTPFlows.MeasurementFamily,
        number | string,
        number | string,
        boolean,
      ],
    null | VAPI.PTPFlows.AgentSlaveStatisticsInstantaneousEstimate,
    VAPI.PTPFlows.AgentSlaveStatistics
  > {
    return new VScript.rKeyword<
      VScript.VSocket,
      | null
      | [
          VAPI.PTPFlows.MeasurementFamily,
          number | string,
          number | string,
          boolean,
        ],
      null | VAPI.PTPFlows.AgentSlaveStatisticsInstantaneousEstimate,
      VAPI.PTPFlows.AgentSlaveStatistics
    >(this, "instantaneous_estimate" as VScript.SysName, {
      lift: VScript.VAPIHelpers.liftOrLowerNullable(
        VAPI.PTPFlows.lift.AgentSlaveStatisticsInstantaneousEstimate,
      ),
      lower: VScript.VAPIHelpers.liftOrLowerNullable(
        VAPI.PTPFlows.lower.AgentSlaveStatisticsInstantaneousEstimate,
      ),
    });
  }
}
export type AgentState =
  | "Inactive"
  | "Listening"
  | "Passive"
  | "Slave"
  | "Master";
export const Enums = {
  Routing: ["Unicast", "Multicast"] as Routing[],
  QualityAssessment: [
    "Convergent",
    "Normal",
    "Divergent",
    "None",
  ] as QualityAssessment[],
  MessageType: [
    "Sync",
    "Delay_Req",
    "Pdelay_Req",
    "Pdelay_Resp",
    "Follow_Up",
    "Delay_Resp",
    "Pdelay_Resp_Follow_Up",
    "Announce",
    "Signaling",
    "Management",
    "Invalid",
  ] as MessageType[],
  MessageClass: ["Event", "General"] as MessageClass[],
  MeasurementFamily: ["SyncFollowUp", "DelayRespReq"] as MeasurementFamily[],
} as const;
