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

export interface ConditionArgs extends core.SchemaArgs {
  key: string | core.StringOut;

  type: string | core.StringOut;

  value: string | core.StringOut;
}

export class Condition extends core.Schema<ConditionArgs> {
  @core.attr(String)
  public key!: string | core.StringOut;

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

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

export interface CloudwatchEventPermissionArgs extends core.ResourceArgs {
  action?: string | core.StringOut;

  condition?: Condition;

  eventBusName?: string | core.StringOut;

  principal: string | core.StringOut;

  statementId: string | core.StringOut;
}

export class CloudwatchEventPermission extends core.Resource<CloudwatchEventPermissionArgs> {
  @core.attr(String)
  public action?: string | core.StringOut;

  @core.attr(Condition)
  public condition?: Condition;

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

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

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

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

  constructor(name: string, args?: CloudwatchEventPermissionArgs) {
    super(name, "aws_cloudwatch_event_permission", args);
  }

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