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

export interface SourceCodeVersionArgs extends core.SchemaArgs {
  type: string | core.StringOut;

  value: string | core.StringOut;
}

export class SourceCodeVersion extends core.Schema<SourceCodeVersionArgs> {
  @core.attr(String)
  public type!: string | core.StringOut;

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

export interface CodeConfigurationValuesArgs extends core.SchemaArgs {
  buildCommand?: string | core.StringOut;

  port?: string | core.StringOut;

  runtime: string | core.StringOut;

  runtimeEnvironmentVariables?:
    | core.Map<string, string>
    | core.MapOut<core.StringOut>;

  startCommand?: string | core.StringOut;
}

export class CodeConfigurationValues extends core.Schema<CodeConfigurationValuesArgs> {
  @core.attr(String)
  public buildCommand?: string | core.StringOut;

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

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

  @core.attr(String, { kind: "map" })
  public runtimeEnvironmentVariables?:
    | core.Map<string, string>
    | core.MapOut<core.StringOut>;

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

export interface CodeConfigurationArgs extends core.SchemaArgs {
  codeConfigurationValues?: CodeConfigurationValues;

  configurationSource: string | core.StringOut;
}

export class CodeConfiguration extends core.Schema<CodeConfigurationArgs> {
  @core.attr(CodeConfigurationValues)
  public codeConfigurationValues?: CodeConfigurationValues;

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

export interface CodeRepositoryArgs extends core.SchemaArgs {
  codeConfiguration?: CodeConfiguration;

  repositoryUrl: string | core.StringOut;

  sourceCodeVersion: SourceCodeVersion;
}

export class CodeRepository extends core.Schema<CodeRepositoryArgs> {
  @core.attr(CodeConfiguration)
  public codeConfiguration?: CodeConfiguration;

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

  @core.attr(SourceCodeVersion)
  public sourceCodeVersion!: SourceCodeVersion;
}

export interface ImageConfigurationArgs extends core.SchemaArgs {
  port?: string | core.StringOut;

  runtimeEnvironmentVariables?:
    | core.Map<string, string>
    | core.MapOut<core.StringOut>;

  startCommand?: string | core.StringOut;
}

export class ImageConfiguration extends core.Schema<ImageConfigurationArgs> {
  @core.attr(String)
  public port?: string | core.StringOut;

  @core.attr(String, { kind: "map" })
  public runtimeEnvironmentVariables?:
    | core.Map<string, string>
    | core.MapOut<core.StringOut>;

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

export interface ImageRepositoryArgs extends core.SchemaArgs {
  imageConfiguration?: ImageConfiguration;

  imageIdentifier: string | core.StringOut;

  imageRepositoryType: string | core.StringOut;
}

export class ImageRepository extends core.Schema<ImageRepositoryArgs> {
  @core.attr(ImageConfiguration)
  public imageConfiguration?: ImageConfiguration;

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

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

export interface AuthenticationConfigurationArgs extends core.SchemaArgs {
  accessRoleArn?: string | core.StringOut;

  connectionArn?: string | core.StringOut;
}

export class AuthenticationConfiguration extends core.Schema<AuthenticationConfigurationArgs> {
  @core.attr(String)
  public accessRoleArn?: string | core.StringOut;

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

export interface SourceConfigurationArgs extends core.SchemaArgs {
  authenticationConfiguration?: AuthenticationConfiguration;

  autoDeploymentsEnabled?: boolean | core.BooleanOut;

  codeRepository?: CodeRepository;

  imageRepository?: ImageRepository;
}

export class SourceConfiguration extends core.Schema<SourceConfigurationArgs> {
  @core.attr(AuthenticationConfiguration)
  public authenticationConfiguration?: AuthenticationConfiguration;

  @core.attr(Boolean)
  public autoDeploymentsEnabled?: boolean | core.BooleanOut;

  @core.attr(CodeRepository)
  public codeRepository?: CodeRepository;

  @core.attr(ImageRepository)
  public imageRepository?: ImageRepository;
}

export interface InstanceConfigurationArgs extends core.SchemaArgs {
  cpu?: string | core.StringOut;

  instanceRoleArn?: string | core.StringOut;

  memory?: string | core.StringOut;
}

export class InstanceConfiguration extends core.Schema<InstanceConfigurationArgs> {
  @core.attr(String)
  public cpu?: string | core.StringOut;

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

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

export interface HealthCheckConfigurationArgs extends core.SchemaArgs {
  healthyThreshold?: number | core.NumberOut;

  interval?: number | core.NumberOut;

  path?: string | core.StringOut;

  protocol?: string | core.StringOut;

  timeout?: number | core.NumberOut;

  unhealthyThreshold?: number | core.NumberOut;
}

export class HealthCheckConfiguration extends core.Schema<HealthCheckConfigurationArgs> {
  @core.attr(Number)
  public healthyThreshold?: number | core.NumberOut;

  @core.attr(Number)
  public interval?: number | core.NumberOut;

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

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

  @core.attr(Number)
  public timeout?: number | core.NumberOut;

  @core.attr(Number)
  public unhealthyThreshold?: number | core.NumberOut;
}

export interface EgressConfigurationArgs extends core.SchemaArgs {
  egressType?: string | core.StringOut;

  vpcConnectorArn?: string | core.StringOut;
}

export class EgressConfiguration extends core.Schema<EgressConfigurationArgs> {
  @core.attr(String, { computed: true })
  public egressType?: string | core.StringOut;

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

export interface NetworkConfigurationArgs extends core.SchemaArgs {
  egressConfiguration?: EgressConfiguration;
}

export class NetworkConfiguration extends core.Schema<NetworkConfigurationArgs> {
  @core.attr(EgressConfiguration)
  public egressConfiguration?: EgressConfiguration;
}

export interface ObservabilityConfigurationArgs extends core.SchemaArgs {
  observabilityConfigurationArn: string | core.StringOut;

  observabilityEnabled: boolean | core.BooleanOut;
}

export class ObservabilityConfiguration extends core.Schema<ObservabilityConfigurationArgs> {
  @core.attr(String)
  public observabilityConfigurationArn!: string | core.StringOut;

  @core.attr(Boolean)
  public observabilityEnabled!: boolean | core.BooleanOut;
}

export interface EncryptionConfigurationArgs extends core.SchemaArgs {
  kmsKey: string | core.StringOut;
}

export class EncryptionConfiguration extends core.Schema<EncryptionConfigurationArgs> {
  @core.attr(String)
  public kmsKey!: string | core.StringOut;
}

export interface ServiceArgs extends core.ResourceArgs {
  autoScalingConfigurationArn?: string | core.StringOut;

  encryptionConfiguration?: EncryptionConfiguration;

  healthCheckConfiguration?: HealthCheckConfiguration;

  instanceConfiguration?: InstanceConfiguration;

  networkConfiguration?: NetworkConfiguration;

  observabilityConfiguration?: ObservabilityConfiguration;

  serviceName: string | core.StringOut;

  sourceConfiguration: SourceConfiguration;

  tags?: core.Map<string, string> | core.MapOut<core.StringOut>;

  tagsAll?: core.Map<string, string> | core.MapOut<core.StringOut>;
}

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

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

  @core.attr(EncryptionConfiguration)
  public encryptionConfiguration?: EncryptionConfiguration;

  @core.attr(HealthCheckConfiguration, { computed: true })
  public healthCheckConfiguration?: HealthCheckConfiguration;

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

  @core.attr(InstanceConfiguration, { computed: true })
  public instanceConfiguration?: InstanceConfiguration;

  @core.attr(NetworkConfiguration, { computed: true })
  public networkConfiguration?: NetworkConfiguration;

  @core.attr(ObservabilityConfiguration)
  public observabilityConfiguration?: ObservabilityConfiguration;

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

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

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

  @core.attr(SourceConfiguration)
  public sourceConfiguration!: SourceConfiguration;

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

  @core.attr(String, { kind: "map" })
  public tags?: core.Map<string, string> | core.MapOut<core.StringOut>;

  @core.attr(String, { computed: true, kind: "map" })
  public tagsAll?: core.Map<string, string> | core.MapOut<core.StringOut>;

  constructor(name: string, args?: ServiceArgs) {
    super(name, "aws_apprunner_service", args);
  }

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