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

export interface FilterArgs extends core.SchemaArgs {
  excludeMatchedPattern?: boolean | core.BooleanOut;

  pattern: string | core.StringOut;

  type: string | core.StringOut;
}

export class Filter extends core.Schema<FilterArgs> {
  @core.attr(Boolean)
  public excludeMatchedPattern?: boolean | core.BooleanOut;

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

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

export interface FilterGroupArgs extends core.SchemaArgs {
  filter?: core.Array<Filter> | core.ArrayOut<Filter>;
}

export class FilterGroup extends core.Schema<FilterGroupArgs> {
  @core.attr(Filter, { kind: "array" })
  public filter?: core.Array<Filter> | core.ArrayOut<Filter>;
}

export interface WebhookArgs extends core.ResourceArgs {
  branchFilter?: string | core.StringOut;

  buildType?: string | core.StringOut;

  filterGroup?: core.Array<FilterGroup> | core.ArrayOut<FilterGroup>;

  projectName: string | core.StringOut;
}

export class Webhook extends core.Resource<WebhookArgs> {
  @core.attr(String)
  public branchFilter?: string | core.StringOut;

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

  @core.attr(FilterGroup, { kind: "array" })
  public filterGroup?: core.Array<FilterGroup> | core.ArrayOut<FilterGroup>;

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

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

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

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

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

  constructor(name: string, args?: WebhookArgs) {
    super(name, "aws_codebuild_webhook", args);
  }

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