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

export interface DestinationArgs extends core.SchemaArgs {
  region: string | core.StringOut;

  registryId: string | core.StringOut;
}

export class Destination extends core.Schema<DestinationArgs> {
  @core.attr(String)
  public region!: string | core.StringOut;

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

export interface RepositoryFilterArgs extends core.SchemaArgs {
  filter: string | core.StringOut;

  filterType: string | core.StringOut;
}

export class RepositoryFilter extends core.Schema<RepositoryFilterArgs> {
  @core.attr(String)
  public filter!: string | core.StringOut;

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

export interface RuleArgs extends core.SchemaArgs {
  destination: core.Array<Destination> | core.ArrayOut<Destination>;

  repositoryFilter?:
    | core.Array<RepositoryFilter>
    | core.ArrayOut<RepositoryFilter>;
}

export class Rule extends core.Schema<RuleArgs> {
  @core.attr(Destination, { kind: "array" })
  public destination!: core.Array<Destination> | core.ArrayOut<Destination>;

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

export interface ReplicationConfigurationBlkArgs extends core.SchemaArgs {
  rule: core.Array<Rule> | core.ArrayOut<Rule>;
}

export class ReplicationConfigurationBlk extends core.Schema<ReplicationConfigurationBlkArgs> {
  @core.attr(Rule, { kind: "array" })
  public rule!: core.Array<Rule> | core.ArrayOut<Rule>;
}

export interface ReplicationConfigurationArgs extends core.ResourceArgs {
  replicationConfiguration?: ReplicationConfigurationBlk;
}

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

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

  @core.attr(ReplicationConfigurationBlk)
  public replicationConfiguration?: ReplicationConfigurationBlk;

  constructor(name: string, args?: ReplicationConfigurationArgs) {
    super(name, "aws_ecr_replication_configuration", args);
  }

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