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

export interface VirtualServiceArgs extends core.SchemaArgs {
  virtualServiceName: string | core.StringOut;
}

export class VirtualService extends core.Schema<VirtualServiceArgs> {
  @core.attr(String)
  public virtualServiceName!: string | core.StringOut;
}

export interface TargetArgs extends core.SchemaArgs {
  virtualService: VirtualService;
}

export class Target extends core.Schema<TargetArgs> {
  @core.attr(VirtualService)
  public virtualService!: VirtualService;
}

export interface GrpcRouteActionArgs extends core.SchemaArgs {
  target: Target;
}

export class GrpcRouteAction extends core.Schema<GrpcRouteActionArgs> {
  @core.attr(Target)
  public target!: Target;
}

export interface GrpcRouteMatchArgs extends core.SchemaArgs {
  serviceName: string | core.StringOut;
}

export class GrpcRouteMatch extends core.Schema<GrpcRouteMatchArgs> {
  @core.attr(String)
  public serviceName!: string | core.StringOut;
}

export interface GrpcRouteArgs extends core.SchemaArgs {
  action: GrpcRouteAction;

  match: GrpcRouteMatch;
}

export class GrpcRoute extends core.Schema<GrpcRouteArgs> {
  @core.attr(GrpcRouteAction)
  public action!: GrpcRouteAction;

  @core.attr(GrpcRouteMatch)
  public match!: GrpcRouteMatch;
}

export interface RewriteHostnameArgs extends core.SchemaArgs {
  defaultTargetHostname: string | core.StringOut;
}

export class RewriteHostname extends core.Schema<RewriteHostnameArgs> {
  @core.attr(String)
  public defaultTargetHostname!: string | core.StringOut;
}

export interface PrefixArgs extends core.SchemaArgs {
  defaultPrefix?: string | core.StringOut;

  value?: string | core.StringOut;
}

export class Prefix extends core.Schema<PrefixArgs> {
  @core.attr(String)
  public defaultPrefix?: string | core.StringOut;

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

export interface RewriteArgs extends core.SchemaArgs {
  hostname?: RewriteHostname;

  prefix?: Prefix;
}

export class Rewrite extends core.Schema<RewriteArgs> {
  @core.attr(RewriteHostname)
  public hostname?: RewriteHostname;

  @core.attr(Prefix)
  public prefix?: Prefix;
}

export interface Http2RouteActionArgs extends core.SchemaArgs {
  rewrite?: Rewrite;

  target: Target;
}

export class Http2RouteAction extends core.Schema<Http2RouteActionArgs> {
  @core.attr(Rewrite)
  public rewrite?: Rewrite;

  @core.attr(Target)
  public target!: Target;
}

export interface Http2RouteMatchHostnameArgs extends core.SchemaArgs {
  exact?: string | core.StringOut;

  suffix?: string | core.StringOut;
}

export class Http2RouteMatchHostname extends core.Schema<Http2RouteMatchHostnameArgs> {
  @core.attr(String)
  public exact?: string | core.StringOut;

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

export interface Http2RouteMatchArgs extends core.SchemaArgs {
  hostname?: Http2RouteMatchHostname;

  prefix?: string | core.StringOut;
}

export class Http2RouteMatch extends core.Schema<Http2RouteMatchArgs> {
  @core.attr(Http2RouteMatchHostname)
  public hostname?: Http2RouteMatchHostname;

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

export interface Http2RouteArgs extends core.SchemaArgs {
  action: Http2RouteAction;

  match: Http2RouteMatch;
}

export class Http2Route extends core.Schema<Http2RouteArgs> {
  @core.attr(Http2RouteAction)
  public action!: Http2RouteAction;

  @core.attr(Http2RouteMatch)
  public match!: Http2RouteMatch;
}

export interface HttpRouteArgs extends core.SchemaArgs {
  action: Http2RouteAction;

  match: Http2RouteMatch;
}

export class HttpRoute extends core.Schema<HttpRouteArgs> {
  @core.attr(Http2RouteAction)
  public action!: Http2RouteAction;

  @core.attr(Http2RouteMatch)
  public match!: Http2RouteMatch;
}

export interface SpecArgs extends core.SchemaArgs {
  grpcRoute?: GrpcRoute;

  http2Route?: Http2Route;

  httpRoute?: HttpRoute;
}

export class Spec extends core.Schema<SpecArgs> {
  @core.attr(GrpcRoute)
  public grpcRoute?: GrpcRoute;

  @core.attr(Http2Route)
  public http2Route?: Http2Route;

  @core.attr(HttpRoute)
  public httpRoute?: HttpRoute;
}

export interface GatewayRouteArgs extends core.ResourceArgs {
  meshName: string | core.StringOut;

  meshOwner?: string | core.StringOut;

  name: string | core.StringOut;

  spec: Spec;

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

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

  virtualGatewayName: string | core.StringOut;
}

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

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

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

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

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

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

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

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

  @core.attr(Spec)
  public spec!: Spec;

  @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>;

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

  constructor(name: string, args?: GatewayRouteArgs) {
    super(name, "aws_appmesh_gateway_route", args);
  }

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