// @generated by protoc-gen-es v1.7.2 with parameter "target=ts"
// @generated from file flyteidl/core/dynamic_job.proto (package flyteidl.core, syntax proto3)
/* eslint-disable */
// @ts-nocheck

import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
import { Node, WorkflowTemplate } from "./workflow_pb.js";
import { Binding } from "./literals_pb.js";
import { TaskTemplate } from "./tasks_pb.js";

/**
 * Describes a set of tasks to execute and how the final outputs are produced.
 *
 * @generated from message flyteidl.core.DynamicJobSpec
 */
export class DynamicJobSpec extends Message<DynamicJobSpec> {
  /**
   * A collection of nodes to execute.
   *
   * @generated from field: repeated flyteidl.core.Node nodes = 1;
   */
  nodes: Node[] = [];

  /**
   * An absolute number of successful completions of nodes required to mark this job as succeeded. As soon as this
   * criteria is met, the dynamic job will be marked as successful and outputs will be computed. If this number
   * becomes impossible to reach (e.g. number of currently running tasks + number of already succeeded tasks <
   * min_successes) the task will be aborted immediately and marked as failed. The default value of this field, if not
   * specified, is the count of nodes repeated field.
   *
   * @generated from field: int64 min_successes = 2;
   */
  minSuccesses = protoInt64.zero;

  /**
   * Describes how to bind the final output of the dynamic job from the outputs of executed nodes. The referenced ids
   * in bindings should have the generated id for the subtask.
   *
   * @generated from field: repeated flyteidl.core.Binding outputs = 3;
   */
  outputs: Binding[] = [];

  /**
   * [Optional] A complete list of task specs referenced in nodes.
   *
   * @generated from field: repeated flyteidl.core.TaskTemplate tasks = 4;
   */
  tasks: TaskTemplate[] = [];

  /**
   * [Optional] A complete list of task specs referenced in nodes.
   *
   * @generated from field: repeated flyteidl.core.WorkflowTemplate subworkflows = 5;
   */
  subworkflows: WorkflowTemplate[] = [];

  constructor(data?: PartialMessage<DynamicJobSpec>) {
    super();
    proto3.util.initPartial(data, this);
  }

  static readonly runtime: typeof proto3 = proto3;
  static readonly typeName = "flyteidl.core.DynamicJobSpec";
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
    { no: 1, name: "nodes", kind: "message", T: Node, repeated: true },
    { no: 2, name: "min_successes", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
    { no: 3, name: "outputs", kind: "message", T: Binding, repeated: true },
    { no: 4, name: "tasks", kind: "message", T: TaskTemplate, repeated: true },
    { no: 5, name: "subworkflows", kind: "message", T: WorkflowTemplate, repeated: true },
  ]);

  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DynamicJobSpec {
    return new DynamicJobSpec().fromBinary(bytes, options);
  }

  static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DynamicJobSpec {
    return new DynamicJobSpec().fromJson(jsonValue, options);
  }

  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DynamicJobSpec {
    return new DynamicJobSpec().fromJsonString(jsonString, options);
  }

  static equals(a: DynamicJobSpec | PlainMessage<DynamicJobSpec> | undefined, b: DynamicJobSpec | PlainMessage<DynamicJobSpec> | undefined): boolean {
    return proto3.util.equals(DynamicJobSpec, a, b);
  }
}

