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

export interface ScopeArgs extends core.SchemaArgs {
  scopeDescription: string | core.StringOut;

  scopeName: string | core.StringOut;
}

export class Scope extends core.Schema<ScopeArgs> {
  @core.attr(String)
  public scopeDescription!: string | core.StringOut;

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

export interface ResourceServerArgs extends core.ResourceArgs {
  /**
   * (Required) An identifier for the resource server.
   */
  identifier: string | core.StringOut;

  /**
   * (Required) A name for the resource server.
   */
  name: string | core.StringOut;

  /**
   * (Optional) A list of [Authorization Scope](#authorization-scope).
   */
  scope?: core.Array<Scope> | core.ArrayOut<Scope>;

  userPoolId: string | core.StringOut;
}

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

  /**
   * (Required) An identifier for the resource server.
   */
  @core.attr(String)
  public identifier!: string | core.StringOut;

  /**
   * (Required) A name for the resource server.
   */
  @core.attr(String)
  public name!: string | core.StringOut;

  /**
   * (Optional) A list of [Authorization Scope](#authorization-scope).
   */
  @core.attr(Scope, { kind: "array" })
  public scope?: core.Array<Scope> | core.ArrayOut<Scope>;

  /**
   * A list of all scopes configured for this resource server in the format identifier/scope_name.
   */
  @core.attr(String, { computed: true, kind: "array" })
  public scopeIdentifiers!: core.Array<string> | core.ArrayOut<core.StringOut>;

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

  constructor(name: string, args?: ResourceServerArgs) {
    super(name, "aws_cognito_resource_server", args);
  }

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