// 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> = {
  "assignShelfSku": {
    variantsByTypeName: {
      "ShelfSkuOutput": {
        statusCode: 201,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "ServiceUnavailable": {
        statusCode: 503,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [["Content-Type", "application/problem+json"]],
      },
    },
    variantsByStatus: {
      201: "ShelfSkuOutput",
      503: "ServiceUnavailable",
    },
  },
  "AssignShelfSku": {
    variantsByTypeName: {
      "ShelfSkuOutput": {
        statusCode: 201,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "ServiceUnavailable": {
        statusCode: 503,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [["Content-Type", "application/problem+json"]],
      },
    },
    variantsByStatus: {
      201: "ShelfSkuOutput",
      503: "ServiceUnavailable",
    },
  },
  "createShelfItem": {
    variantsByTypeName: {
      "ShelfItemOutput": {
        statusCode: 201,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "Conflict": {
        statusCode: 409,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "ServiceUnavailable": {
        statusCode: 503,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [["Content-Type", "application/problem+json"]],
      },
    },
    variantsByStatus: {
      201: "ShelfItemOutput",
      409: "Conflict",
      503: "ServiceUnavailable",
    },
  },
  "CreateShelfItem": {
    variantsByTypeName: {
      "ShelfItemOutput": {
        statusCode: 201,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "Conflict": {
        statusCode: 409,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [],
      },
      "ServiceUnavailable": {
        statusCode: 503,
        mediaType: "application/json",
        headerBindings: [],
        staticHeaders: [["Content-Type", "application/problem+json"]],
      },
    },
    variantsByStatus: {
      201: "ShelfItemOutput",
      409: "Conflict",
      503: "ServiceUnavailable",
    },
  },
};
