#!/usr/bin/env node
import "dotenv/config"; // Load Envars
import Qualiteer from "qualiteer";
import { Initiator, Executor } from "qualiteer/clients";

// Start server
const qltr = new Qualiteer();
await qltr.start();

const url = process.env.QUALITEER_URL;

// Create an initiator and make a job request
const primary = new Initiator(url);
const job = {
  pipeline: {
    __test: "primary",
    triggers: {
      secondary1: {
        __testDelay: 1000,
        tertiary1: {},
        tertiary2: {
          __testDelay: 8000,
        },
      },
      secondary2: {
        __testDelay: 20000,
        tertiary3: {
          __testDelay: 3000,
        },
      },
    },
  },
  name: "testing",
  image: "node",
};

const launchJob = () =>
  primary.newPipelineJob(job, null, () => console.log("Primary Job Concluded"));
launchJob();
