// 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> = {
  "getCategory": {
    variantsByTypeName: {
      "GetCategoryOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "CategoryNotFound": {
        statusCode: 404,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "GetCategoryOutput",
      404: "CategoryNotFound",
    },
  },
  "GetCategory": {
    variantsByTypeName: {
      "GetCategoryOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "CategoryNotFound": {
        statusCode: 404,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "GetCategoryOutput",
      404: "CategoryNotFound",
    },
  },
  "healthCheck": {
    variantsByTypeName: {
      "HealthCheckOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [["Cache-Control", "no-store"]],
      },
    },
    variantsByStatus: {
      200: "HealthCheckOutput",
    },
  },
  "HealthCheck": {
    variantsByTypeName: {
      "HealthCheckOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [["Cache-Control", "no-store"]],
      },
    },
    variantsByStatus: {
      200: "HealthCheckOutput",
    },
  },
  "getOrder": {
    variantsByTypeName: {
      "GetOrderOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "OrderNotFound": {
        statusCode: 404,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "GetOrderOutput",
      404: "OrderNotFound",
    },
  },
  "GetOrder": {
    variantsByTypeName: {
      "GetOrderOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "OrderNotFound": {
        statusCode: 404,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "GetOrderOutput",
      404: "OrderNotFound",
    },
  },
  "placeOrder": {
    variantsByTypeName: {
      "PlaceOrderOutput": {
        statusCode: 201,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "ValidationError": {
        statusCode: 400,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      201: "PlaceOrderOutput",
      400: "ValidationError",
    },
  },
  "PlaceOrder": {
    variantsByTypeName: {
      "PlaceOrderOutput": {
        statusCode: 201,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "ValidationError": {
        statusCode: 400,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      201: "PlaceOrderOutput",
      400: "ValidationError",
    },
  },
  "createPet": {
    variantsByTypeName: {
      "CreatePetOutput": {
        statusCode: 201,
        mediaType: "application/json",
        headerBindings: [["etag", "ETag"]],
        staticHeaders: [],
      },
      "ValidationError": {
        statusCode: 400,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      201: "CreatePetOutput",
      400: "ValidationError",
    },
  },
  "CreatePet": {
    variantsByTypeName: {
      "CreatePetOutput": {
        statusCode: 201,
        mediaType: "application/json",
        headerBindings: [["etag", "ETag"]],
        staticHeaders: [],
      },
      "ValidationError": {
        statusCode: 400,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      201: "CreatePetOutput",
      400: "ValidationError",
    },
  },
  "deletePet": {
    variantsByTypeName: {
      "__empty__": {
        statusCode: 204,
        mediaType: null,
        headerBindings: [],
        staticHeaders: [],
      },
      "PetNotFound": {
        statusCode: 404,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      204: "__empty__",
      404: "PetNotFound",
    },
  },
  "DeletePet": {
    variantsByTypeName: {
      "__empty__": {
        statusCode: 204,
        mediaType: null,
        headerBindings: [],
        staticHeaders: [],
      },
      "PetNotFound": {
        statusCode: 404,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      204: "__empty__",
      404: "PetNotFound",
    },
  },
  "getPet": {
    variantsByTypeName: {
      "GetPetOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "PetNotFound": {
        statusCode: 404,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "GetPetOutput",
      404: "PetNotFound",
    },
  },
  "GetPet": {
    variantsByTypeName: {
      "GetPetOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "PetNotFound": {
        statusCode: 404,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "GetPetOutput",
      404: "PetNotFound",
    },
  },
  "petEvents": {
    variantsByTypeName: {
      "PetEventsOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "PetEventsOutput",
    },
  },
  "PetEvents": {
    variantsByTypeName: {
      "PetEventsOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "PetEventsOutput",
    },
  },
  "resolvePetLocation": {
    variantsByTypeName: {
      "PetLocationRedirect": {
        statusCode: 302,
        mediaType: null,
        headerBindings: [["url", "Location"]],
        staticHeaders: [],
      },
      "PetNotFound": {
        statusCode: 404,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      302: "PetLocationRedirect",
      404: "PetNotFound",
    },
  },
  "ResolvePetLocation": {
    variantsByTypeName: {
      "PetLocationRedirect": {
        statusCode: 302,
        mediaType: null,
        headerBindings: [["url", "Location"]],
        staticHeaders: [],
      },
      "PetNotFound": {
        statusCode: 404,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      302: "PetLocationRedirect",
      404: "PetNotFound",
    },
  },
  "updatePet": {
    variantsByTypeName: {
      "UpdatePetOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "PetNotFound": {
        statusCode: 404,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "ValidationError": {
        statusCode: 400,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "UpdatePetOutput",
      404: "PetNotFound",
      400: "ValidationError",
    },
  },
  "UpdatePet": {
    variantsByTypeName: {
      "UpdatePetOutput": {
        statusCode: 200,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "PetNotFound": {
        statusCode: 404,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "ValidationError": {
        statusCode: 400,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
    },
    variantsByStatus: {
      200: "UpdatePetOutput",
      404: "PetNotFound",
      400: "ValidationError",
    },
  },
};
