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

export interface RedirectAllRequestsToArgs extends core.SchemaArgs {
  hostName: string | core.StringOut;

  protocol?: string | core.StringOut;
}

export class RedirectAllRequestsTo extends core.Schema<RedirectAllRequestsToArgs> {
  @core.attr(String)
  public hostName!: string | core.StringOut;

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

export interface RedirectArgs extends core.SchemaArgs {
  hostName?: string | core.StringOut;

  httpRedirectCode?: string | core.StringOut;

  protocol?: string | core.StringOut;

  replaceKeyPrefixWith?: string | core.StringOut;

  replaceKeyWith?: string | core.StringOut;
}

export class Redirect extends core.Schema<RedirectArgs> {
  @core.attr(String)
  public hostName?: string | core.StringOut;

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

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

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

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

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

  keyPrefixEquals?: string | core.StringOut;
}

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

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

export interface RoutingRuleArgs extends core.SchemaArgs {
  condition?: Condition;

  redirect: Redirect;
}

export class RoutingRule extends core.Schema<RoutingRuleArgs> {
  @core.attr(Condition)
  public condition?: Condition;

  @core.attr(Redirect)
  public redirect!: Redirect;
}

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

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

export interface IndexDocumentArgs extends core.SchemaArgs {
  suffix: string | core.StringOut;
}

export class IndexDocument extends core.Schema<IndexDocumentArgs> {
  @core.attr(String)
  public suffix!: string | core.StringOut;
}

export interface BucketWebsiteConfigurationArgs extends core.ResourceArgs {
  bucket: string | core.StringOut;

  errorDocument?: ErrorDocument;

  expectedBucketOwner?: string | core.StringOut;

  indexDocument?: IndexDocument;

  redirectAllRequestsTo?: RedirectAllRequestsTo;

  routingRule?: core.Array<RoutingRule> | core.ArrayOut<RoutingRule>;

  routingRules?: string | core.StringOut;
}

export class BucketWebsiteConfiguration extends core.Resource<BucketWebsiteConfigurationArgs> {
  @core.attr(String)
  public bucket!: string | core.StringOut;

  @core.attr(ErrorDocument)
  public errorDocument?: ErrorDocument;

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

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

  @core.attr(IndexDocument)
  public indexDocument?: IndexDocument;

  @core.attr(RedirectAllRequestsTo)
  public redirectAllRequestsTo?: RedirectAllRequestsTo;

  @core.attr(RoutingRule, { computed: true, kind: "array" })
  public routingRule?: core.Array<RoutingRule> | core.ArrayOut<RoutingRule>;

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

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

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

  constructor(name: string, args?: BucketWebsiteConfigurationArgs) {
    super(name, "aws_s3_bucket_website_configuration", args);
  }

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