// Generated by smithplates HTTP codegen. Do not edit.

export interface ResponseVariantBinding {
  statusCode: number;
  mediaType: string | null;
  headerBindings: Array<[string, string]>;
  staticHeaders: Array<[string, string]>;
}

export interface ClientOperationHttpBinding {
  variantsByTypeName: Record<string, ResponseVariantBinding>;
  variantsByStatus: Record<number, string>;
}

/** Look up the response variant registered for a given HTTP status code. */
export function variantForStatus(
  binding: ClientOperationHttpBinding,
  statusCode: number,
): ResponseVariantBinding {
  const typeName = binding.variantsByStatus[statusCode];
  if (typeName === undefined) {
    throw new Error("No HTTP binding registered for response status " + statusCode);
  }
  const variant = binding.variantsByTypeName[typeName];
  if (variant === undefined) {
    throw new Error("No HTTP binding registered for response type " + typeName);
  }
  return variant;
}

/** Look up the response model type name registered for a given HTTP status code. */
export function typeNameForStatus(
  binding: ClientOperationHttpBinding,
  statusCode: number,
): string {
  const typeName = binding.variantsByStatus[statusCode];
  if (typeName === undefined) {
    throw new Error("No HTTP binding registered for response status " + statusCode);
  }
  return typeName;
}

export const OPERATION_HTTP_BINDINGS: Record<string, ClientOperationHttpBinding> = {
  "chatStream": {
    variantsByTypeName: {
      "ServerMessage": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "ServerMessage",
    },
  },
  "ChatStream": {
    variantsByTypeName: {
      "ServerMessage": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "ServerMessage",
    },
  },
  "listRooms": {
    variantsByTypeName: {
      "RoomListOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "RoomListOutput",
    },
  },
  "ListRooms": {
    variantsByTypeName: {
      "RoomListOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "RoomListOutput",
    },
  },
  "sendRoomMessage": {
    variantsByTypeName: {
      "ServerMessage": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "ServerMessage",
    },
  },
  "SendRoomMessage": {
    variantsByTypeName: {
      "ServerMessage": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "ServerMessage",
    },
  },
  "watchRoom": {
    variantsByTypeName: {
      "ServerMessage": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "ServerMessage",
    },
  },
  "WatchRoom": {
    variantsByTypeName: {
      "ServerMessage": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "ServerMessage",
    },
  },
};
