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 = {
  Filter: (
    _raw: [
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
      null | VAPI.MetadataProcessor.FilterSetting,
    ],
    _socket: VScript.VSocket,
  ): Filter => {
    return {
      if_tc_ltc: _raw[0],
      if_tc_vitc1: _raw[1],
      if_tc_vitc2: _raw[2],
      if_afd1: _raw[3],
      if_afd2: _raw[4],
      if_334_cea_708_cdp: _raw[5],
      if_334_cea_608: _raw[6],
      if_334_program: _raw[7],
      if_334_data: _raw[8],
      if_334_vbi: _raw[9],
      if_vpid: _raw[10],
      if_2010_ansi_scte_104: _raw[11],
      if_2031_dvb_scte_vbi: _raw[12],
      if_rdd_8_op_47: _raw[13],
      if_obs: _raw[14],
      if_other: _raw[15],
    };
  },
  FinePrint: (
    _raw: [
      VAPI.MetadataProcessor.OnChecksumError,
      null | number,
      null | number,
    ],
    _socket: VScript.VSocket,
  ): FinePrint => {
    return {
      on_checksum_error: _raw[0],
      tc_timeout_frames: _raw[1],
      afd_timeout_frames: _raw[2],
    };
  },
  ResponseStatistics: (
    _raw: [
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
      number,
    ],
    _socket: VScript.VSocket,
  ): ResponseStatistics => {
    return {
      packets_pending: _raw[0],
      packets_embedded_tc_ltc: _raw[1],
      packets_embedded_tc_vitc1: _raw[2],
      packets_embedded_tc_vitc2: _raw[3],
      packets_embedded_afd1: _raw[4],
      packets_embedded_afd2: _raw[5],
      packets_embedded_334_cea_708_cdp: _raw[6],
      packets_embedded_334_cea_608: _raw[7],
      packets_embedded_334_program: _raw[8],
      packets_embedded_334_data: _raw[9],
      packets_embedded_334_vbi: _raw[10],
      packets_embedded_vpid: _raw[11],
      packets_embedded_2010_ansi_scte_104: _raw[12],
      packets_embedded_2031_dvb_scte_vbi: _raw[13],
      packets_embedded_rdd_8_op_47: _raw[14],
      packets_embedded_obs: _raw[15],
      packets_embedded_other: _raw[16],
      packets_overflow: _raw[17],
      packets_bad_checksum: _raw[18],
      packets_incompatible_framerate: _raw[19],
    };
  },
  VANCEmbedderLocations: (
    _raw: [
      null | number,
      null | number,
      null | number,
      null | number,
      null | number,
      null | number,
      null | number,
      null | number,
      null | number,
      null | number,
      null | number,
      null | number,
      null | number,
      null | number,
      null | number,
      number,
    ],
    _socket: VScript.VSocket,
  ): VANCEmbedderLocations => {
    return {
      if_tc_ltc: _raw[0],
      if_tc_vitc1: _raw[1],
      if_tc_vitc2: _raw[2],
      if_afd1: _raw[3],
      if_afd2: _raw[4],
      if_334_cea_708_cdp: _raw[5],
      if_334_cea_608: _raw[6],
      if_334_program: _raw[7],
      if_334_data: _raw[8],
      if_334_vbi: _raw[9],
      if_vpid: _raw[10],
      if_2010_ansi_scte_104: _raw[11],
      if_2031_dvb_scte_vbi: _raw[12],
      if_rdd_8_op_47: _raw[13],
      if_obs: _raw[14],
      if_other: _raw[15],
    };
  },
} as const;
export const lower = {
  Filter: (
    _x: {
      if_tc_ltc: null | VAPI.MetadataProcessor.FilterSetting;
      if_tc_vitc1: null | VAPI.MetadataProcessor.FilterSetting;
      if_tc_vitc2: null | VAPI.MetadataProcessor.FilterSetting;
      if_afd1: null | VAPI.MetadataProcessor.FilterSetting;

      /**
        2nd field AFD data
      */
      if_afd2: null | VAPI.MetadataProcessor.FilterSetting;
      if_334_cea_708_cdp: null | VAPI.MetadataProcessor.FilterSetting;
      if_334_cea_608: null | VAPI.MetadataProcessor.FilterSetting;
      if_334_program: null | VAPI.MetadataProcessor.FilterSetting;
      if_334_data: null | VAPI.MetadataProcessor.FilterSetting;
      if_334_vbi: null | VAPI.MetadataProcessor.FilterSetting;
      if_vpid: null | VAPI.MetadataProcessor.FilterSetting;
      if_2010_ansi_scte_104: null | VAPI.MetadataProcessor.FilterSetting;
      if_2031_dvb_scte_vbi: null | VAPI.MetadataProcessor.FilterSetting;
      if_rdd_8_op_47: null | VAPI.MetadataProcessor.FilterSetting;
      if_obs: null | VAPI.MetadataProcessor.FilterSetting;
      if_other: null | VAPI.MetadataProcessor.FilterSetting;
    },
    _socket: VScript.VSocket,
  ): [
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
    null | VAPI.MetadataProcessor.FilterSetting,
  ] => [
    _x.if_tc_ltc,
    _x.if_tc_vitc1,
    _x.if_tc_vitc2,
    _x.if_afd1,
    _x.if_afd2,
    _x.if_334_cea_708_cdp,
    _x.if_334_cea_608,
    _x.if_334_program,
    _x.if_334_data,
    _x.if_334_vbi,
    _x.if_vpid,
    _x.if_2010_ansi_scte_104,
    _x.if_2031_dvb_scte_vbi,
    _x.if_rdd_8_op_47,
    _x.if_obs,
    _x.if_other,
  ],
  FinePrint: (
    _x: {
      on_checksum_error: VAPI.MetadataProcessor.OnChecksumError;
      tc_timeout_frames: null | number;
      afd_timeout_frames: null | number;
    },
    _socket: VScript.VSocket,
  ): [VAPI.MetadataProcessor.OnChecksumError, null | number, null | number] => [
    _x.on_checksum_error,
    _x.tc_timeout_frames,
    _x.afd_timeout_frames,
  ],
  ResponseStatistics: (
    _x: {
      packets_pending: VAPI.Primitives.Unsigned32;
      packets_embedded_tc_ltc: VAPI.Primitives.CyclicCounter32;
      packets_embedded_tc_vitc1: VAPI.Primitives.CyclicCounter32;
      packets_embedded_tc_vitc2: VAPI.Primitives.CyclicCounter32;
      packets_embedded_afd1: VAPI.Primitives.CyclicCounter32;
      packets_embedded_afd2: VAPI.Primitives.CyclicCounter32;
      packets_embedded_334_cea_708_cdp: VAPI.Primitives.CyclicCounter32;
      packets_embedded_334_cea_608: VAPI.Primitives.CyclicCounter32;
      packets_embedded_334_program: VAPI.Primitives.CyclicCounter32;
      packets_embedded_334_data: VAPI.Primitives.CyclicCounter32;
      packets_embedded_334_vbi: VAPI.Primitives.CyclicCounter32;
      packets_embedded_vpid: VAPI.Primitives.CyclicCounter32;
      packets_embedded_2010_ansi_scte_104: VAPI.Primitives.CyclicCounter32;
      packets_embedded_2031_dvb_scte_vbi: VAPI.Primitives.CyclicCounter32;
      packets_embedded_rdd_8_op_47: VAPI.Primitives.CyclicCounter32;
      packets_embedded_obs: VAPI.Primitives.CyclicCounter32;
      packets_embedded_other: VAPI.Primitives.CyclicCounter32;
      packets_overflow: VAPI.Primitives.CyclicCounter32;
      packets_bad_checksum: VAPI.Primitives.CyclicCounter32;
      packets_incompatible_framerate: VAPI.Primitives.CyclicCounter32;
    },
    _socket: VScript.VSocket,
  ): [
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
    number,
  ] => [
    _x.packets_pending,
    _x.packets_embedded_tc_ltc,
    _x.packets_embedded_tc_vitc1,
    _x.packets_embedded_tc_vitc2,
    _x.packets_embedded_afd1,
    _x.packets_embedded_afd2,
    _x.packets_embedded_334_cea_708_cdp,
    _x.packets_embedded_334_cea_608,
    _x.packets_embedded_334_program,
    _x.packets_embedded_334_data,
    _x.packets_embedded_334_vbi,
    _x.packets_embedded_vpid,
    _x.packets_embedded_2010_ansi_scte_104,
    _x.packets_embedded_2031_dvb_scte_vbi,
    _x.packets_embedded_rdd_8_op_47,
    _x.packets_embedded_obs,
    _x.packets_embedded_other,
    _x.packets_overflow,
    _x.packets_bad_checksum,
    _x.packets_incompatible_framerate,
  ],
  VANCEmbedderLocations: (
    _x: {
      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_tc_ltc: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_tc_vitc1: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_tc_vitc2: null | VAPI.MetadataProcessor.LineNumber;

      /**
      AFD embedding location for upper fields/progressive content
    */
      if_afd1: null | VAPI.MetadataProcessor.LineNumber;

      /**
      AFD embedding location for lower fields
    */
      if_afd2: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_334_cea_708_cdp: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_334_cea_608: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_334_program: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_334_data: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_334_vbi: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_vpid: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_2010_ansi_scte_104: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_2031_dvb_scte_vbi: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_rdd_8_op_47: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_obs: null | VAPI.MetadataProcessor.LineNumber;

      /**
      Preferred line to embed into; when set to 4095, anc data will be
      inserted into an arbitrary non-switching line.
    */
      if_other: VAPI.MetadataProcessor.LineNumber;
    },
    _socket: VScript.VSocket,
  ): [
    null | number,
    null | number,
    null | number,
    null | number,
    null | number,
    null | number,
    null | number,
    null | number,
    null | number,
    null | number,
    null | number,
    null | number,
    null | number,
    null | number,
    null | number,
    number,
  ] => [
    _x.if_tc_ltc,
    _x.if_tc_vitc1,
    _x.if_tc_vitc2,
    _x.if_afd1,
    _x.if_afd2,
    _x.if_334_cea_708_cdp,
    _x.if_334_cea_608,
    _x.if_334_program,
    _x.if_334_data,
    _x.if_334_vbi,
    _x.if_vpid,
    _x.if_2010_ansi_scte_104,
    _x.if_2031_dvb_scte_vbi,
    _x.if_rdd_8_op_47,
    _x.if_obs,
    _x.if_other,
  ],
} as const;
export type ChannelState = "Connecting" | "Connected";
export type Event = "ChannelEstablished" | "ChannelClosed";
export interface Filter {
  if_tc_ltc: null | VAPI.MetadataProcessor.FilterSetting;
  if_tc_vitc1: null | VAPI.MetadataProcessor.FilterSetting;
  if_tc_vitc2: null | VAPI.MetadataProcessor.FilterSetting;
  if_afd1: null | VAPI.MetadataProcessor.FilterSetting;

  /**
    2nd field AFD data
  */
  if_afd2: null | VAPI.MetadataProcessor.FilterSetting;
  if_334_cea_708_cdp: null | VAPI.MetadataProcessor.FilterSetting;
  if_334_cea_608: null | VAPI.MetadataProcessor.FilterSetting;
  if_334_program: null | VAPI.MetadataProcessor.FilterSetting;
  if_334_data: null | VAPI.MetadataProcessor.FilterSetting;
  if_334_vbi: null | VAPI.MetadataProcessor.FilterSetting;
  if_vpid: null | VAPI.MetadataProcessor.FilterSetting;
  if_2010_ansi_scte_104: null | VAPI.MetadataProcessor.FilterSetting;
  if_2031_dvb_scte_vbi: null | VAPI.MetadataProcessor.FilterSetting;
  if_rdd_8_op_47: null | VAPI.MetadataProcessor.FilterSetting;
  if_obs: null | VAPI.MetadataProcessor.FilterSetting;
  if_other: null | VAPI.MetadataProcessor.FilterSetting;
}
export type FilterSetting = "Insert" | "Discard";
export interface FinePrint {
  on_checksum_error: VAPI.MetadataProcessor.OnChecksumError;
  tc_timeout_frames: null | number;
  afd_timeout_frames: null | number;
}
/**
  Preferred line to embed into; when set to 4095, anc data will be inserted
  into an arbitrary non-switching line.
*/
export type LineNumber = number;
export type MetadataType =
  | "M_TC_LTC"
  | "M_TC_VITC1"
  | "M_TC_VITC2"
  | "M_AFD1"
  | "M_AFD2"
  | "M_334_CEA_708_CDP"
  | "M_334_CEA_608"
  | "M_334_Program"
  | "M_334_Data"
  | "M_334_VBI"
  | "M_VPID"
  | "M_2010_ANSI_SCTE_104"
  | "M_2031_DVB_SCTE_VBI"
  | "M_RDD_8_OP_47"
  | "M_OBS"
  | "M_Other";
export type OnChecksumError = "InsertAnyway" | "Discard";
export type RTPIndex = number;
export type ResponseIndex = number;
export interface ResponseStatistics {
  packets_pending: VAPI.Primitives.Unsigned32;
  packets_embedded_tc_ltc: VAPI.Primitives.CyclicCounter32;
  packets_embedded_tc_vitc1: VAPI.Primitives.CyclicCounter32;
  packets_embedded_tc_vitc2: VAPI.Primitives.CyclicCounter32;
  packets_embedded_afd1: VAPI.Primitives.CyclicCounter32;
  packets_embedded_afd2: VAPI.Primitives.CyclicCounter32;
  packets_embedded_334_cea_708_cdp: VAPI.Primitives.CyclicCounter32;
  packets_embedded_334_cea_608: VAPI.Primitives.CyclicCounter32;
  packets_embedded_334_program: VAPI.Primitives.CyclicCounter32;
  packets_embedded_334_data: VAPI.Primitives.CyclicCounter32;
  packets_embedded_334_vbi: VAPI.Primitives.CyclicCounter32;
  packets_embedded_vpid: VAPI.Primitives.CyclicCounter32;
  packets_embedded_2010_ansi_scte_104: VAPI.Primitives.CyclicCounter32;
  packets_embedded_2031_dvb_scte_vbi: VAPI.Primitives.CyclicCounter32;
  packets_embedded_rdd_8_op_47: VAPI.Primitives.CyclicCounter32;
  packets_embedded_obs: VAPI.Primitives.CyclicCounter32;
  packets_embedded_other: VAPI.Primitives.CyclicCounter32;
  packets_overflow: VAPI.Primitives.CyclicCounter32;
  packets_bad_checksum: VAPI.Primitives.CyclicCounter32;
  packets_incompatible_framerate: VAPI.Primitives.CyclicCounter32;
}
export interface VANCEmbedderLocations {
  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_tc_ltc: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_tc_vitc1: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_tc_vitc2: null | VAPI.MetadataProcessor.LineNumber;

  /**
    AFD embedding location for upper fields/progressive content
  */
  if_afd1: null | VAPI.MetadataProcessor.LineNumber;

  /**
    AFD embedding location for lower fields
  */
  if_afd2: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_334_cea_708_cdp: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_334_cea_608: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_334_program: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_334_data: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_334_vbi: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_vpid: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_2010_ansi_scte_104: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_2031_dvb_scte_vbi: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_rdd_8_op_47: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_obs: null | VAPI.MetadataProcessor.LineNumber;

  /**
    Preferred line to embed into; when set to 4095, anc data will be inserted
    into an arbitrary non-switching line.
  */
  if_other: VAPI.MetadataProcessor.LineNumber;
}
export type MetadataExtractorExtractorType = "RTP_2110_40" | "SDI";
export const Enums = {
  OnChecksumError: ["InsertAnyway", "Discard"] as OnChecksumError[],
  MetadataType: [
    "M_TC_LTC",
    "M_TC_VITC1",
    "M_TC_VITC2",
    "M_AFD1",
    "M_AFD2",
    "M_334_CEA_708_CDP",
    "M_334_CEA_608",
    "M_334_Program",
    "M_334_Data",
    "M_334_VBI",
    "M_VPID",
    "M_2010_ANSI_SCTE_104",
    "M_2031_DVB_SCTE_VBI",
    "M_RDD_8_OP_47",
    "M_OBS",
    "M_Other",
  ] as MetadataType[],
  FilterSetting: ["Insert", "Discard"] as FilterSetting[],
  Event: ["ChannelEstablished", "ChannelClosed"] as Event[],
  ChannelState: ["Connecting", "Connected"] as ChannelState[],
} as const;
