import * as core from "@terrascript/core";

export interface TriggerBlkArgs extends core.SchemaArgs {
  branches?: core.Array<string> | core.ArrayOut<core.StringOut>;

  customData?: string | core.StringOut;

  destinationArn: string | core.StringOut;

  events: core.Array<string> | core.ArrayOut<core.StringOut>;

  name: string | core.StringOut;
}

export class TriggerBlk extends core.Schema<TriggerBlkArgs> {
  @core.attr(String, { kind: "array" })
  public branches?: core.Array<string> | core.ArrayOut<core.StringOut>;

  @core.attr(String)
  public customData?: string | core.StringOut;

  @core.attr(String)
  public destinationArn!: string | core.StringOut;

  @core.attr(String, { kind: "array" })
  public events!: core.Array<string> | core.ArrayOut<core.StringOut>;

  @core.attr(String)
  public name!: string | core.StringOut;
}

export interface TriggerArgs extends core.ResourceArgs {
  repositoryName: string | core.StringOut;

  trigger: core.Array<TriggerBlk> | core.ArrayOut<TriggerBlk>;
}

export class Trigger extends core.Resource<TriggerArgs> {
  @core.attr(String, { computed: true })
  public configurationId!: string | core.StringOut;

  @core.attr(String, { computed: true })
  public id!: string | core.StringOut;

  @core.attr(String)
  public repositoryName!: string | core.StringOut;

  @core.attr(TriggerBlk, { kind: "array" })
  public trigger!: core.Array<TriggerBlk> | core.ArrayOut<TriggerBlk>;

  constructor(name: string, args?: TriggerArgs) {
    super(name, "aws_codecommit_trigger", args);
  }

  public override getNamespace(): string {
    return "aws_codecommit";
  }
}
