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

export interface OidcArgs extends core.SchemaArgs {
  clientId: string | core.StringOut;

  groupsClaim?: string | core.StringOut;

  groupsPrefix?: string | core.StringOut;

  identityProviderConfigName: string | core.StringOut;

  issuerUrl: string | core.StringOut;

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

  usernameClaim?: string | core.StringOut;

  usernamePrefix?: string | core.StringOut;
}

export class Oidc extends core.Schema<OidcArgs> {
  @core.attr(String)
  public clientId!: string | core.StringOut;

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

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

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

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

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

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

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

export interface IdentityProviderConfigArgs extends core.ResourceArgs {
  clusterName: string | core.StringOut;

  oidc: Oidc;

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

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

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

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

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

  @core.attr(Oidc)
  public oidc!: Oidc;

  @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?: IdentityProviderConfigArgs) {
    super(name, "aws_eks_identity_provider_config", args);
  }

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