// Code generated by go-swagger; DO NOT EDIT.

package product_management

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"github.com/Cyclops-Labs/cyclops-4-hpc.git/services/customerdb/models"
)

// AddProductReader is a Reader for the AddProduct structure.
type AddProductReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *AddProductReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewAddProductCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewAddProductBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewAddProductConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewAddProductInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}

// NewAddProductCreated creates a AddProductCreated with default headers values
func NewAddProductCreated() *AddProductCreated {
	return &AddProductCreated{}
}

/*AddProductCreated handles this case with default header values.

New product was added successfully
*/
type AddProductCreated struct {
	Payload *models.ItemCreatedResponse
}

func (o *AddProductCreated) Error() string {
	return fmt.Sprintf("[POST /product][%d] addProductCreated  %+v", 201, o.Payload)
}

func (o *AddProductCreated) GetPayload() *models.ItemCreatedResponse {
	return o.Payload
}

func (o *AddProductCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ItemCreatedResponse)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewAddProductBadRequest creates a AddProductBadRequest with default headers values
func NewAddProductBadRequest() *AddProductBadRequest {
	return &AddProductBadRequest{}
}

/*AddProductBadRequest handles this case with default header values.

Invalid input, object invalid
*/
type AddProductBadRequest struct {
}

func (o *AddProductBadRequest) Error() string {
	return fmt.Sprintf("[POST /product][%d] addProductBadRequest ", 400)
}

func (o *AddProductBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	return nil
}

// NewAddProductConflict creates a AddProductConflict with default headers values
func NewAddProductConflict() *AddProductConflict {
	return &AddProductConflict{}
}

/*AddProductConflict handles this case with default header values.

The given item already exists
*/
type AddProductConflict struct {
	Payload *models.ErrorResponse
}

func (o *AddProductConflict) Error() string {
	return fmt.Sprintf("[POST /product][%d] addProductConflict  %+v", 409, o.Payload)
}

func (o *AddProductConflict) GetPayload() *models.ErrorResponse {
	return o.Payload
}

func (o *AddProductConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ErrorResponse)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewAddProductInternalServerError creates a AddProductInternalServerError with default headers values
func NewAddProductInternalServerError() *AddProductInternalServerError {
	return &AddProductInternalServerError{}
}

/*AddProductInternalServerError handles this case with default header values.

Something unexpected happend, error raised
*/
type AddProductInternalServerError struct {
	Payload *models.ErrorResponse
}

func (o *AddProductInternalServerError) Error() string {
	return fmt.Sprintf("[POST /product][%d] addProductInternalServerError  %+v", 500, o.Payload)
}

func (o *AddProductInternalServerError) GetPayload() *models.ErrorResponse {
	return o.Payload
}

func (o *AddProductInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ErrorResponse)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}
