import { Schema } from "jsonschema";
import { LambdaInvoker } from "./LambdaInvoker";

export interface IActivity {
  id: string;
  value: string;
  type: string;
}

export class WorkflowInvoker extends LambdaInvoker {
  constructor(private name: string, protected schema: Schema) {
    super("workflow", "execute", schema);
  }

  public getActivity(args: any): IActivity {
    return null;
  }

  public resolvePayload(args) {
    return JSON.stringify({
      input: {
        pub: {
          action: this.name,
          error: null,
          result: null,
        },
        activity: this.getActivity(args),
        ...args,
      },
      name: this.name,
    });
  }
}
