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

package customer_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"
)

// AddCustomerReader is a Reader for the AddCustomer structure.
type AddCustomerReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *AddCustomerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewAddCustomerCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 202:
		result := NewAddCustomerAccepted()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewAddCustomerBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewAddCustomerConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewAddCustomerInternalServerError()
		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())
	}
}

// NewAddCustomerCreated creates a AddCustomerCreated with default headers values
func NewAddCustomerCreated() *AddCustomerCreated {
	return &AddCustomerCreated{}
}

/*AddCustomerCreated handles this case with default header values.

New customer was added successfully
*/
type AddCustomerCreated struct {
	Payload *models.ItemCreatedResponse
}

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

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

func (o *AddCustomerCreated) 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
}

// NewAddCustomerAccepted creates a AddCustomerAccepted with default headers values
func NewAddCustomerAccepted() *AddCustomerAccepted {
	return &AddCustomerAccepted{}
}

/*AddCustomerAccepted handles this case with default header values.

The new customer was added but there might have been some fails when adding part of the data
*/
type AddCustomerAccepted struct {
	Payload *models.ItemCreatedResponse
}

func (o *AddCustomerAccepted) Error() string {
	return fmt.Sprintf("[POST /customer][%d] addCustomerAccepted  %+v", 202, o.Payload)
}

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

func (o *AddCustomerAccepted) 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
}

// NewAddCustomerBadRequest creates a AddCustomerBadRequest with default headers values
func NewAddCustomerBadRequest() *AddCustomerBadRequest {
	return &AddCustomerBadRequest{}
}

/*AddCustomerBadRequest handles this case with default header values.

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

func (o *AddCustomerBadRequest) Error() string {
	return fmt.Sprintf("[POST /customer][%d] addCustomerBadRequest ", 400)
}

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

	return nil
}

// NewAddCustomerConflict creates a AddCustomerConflict with default headers values
func NewAddCustomerConflict() *AddCustomerConflict {
	return &AddCustomerConflict{}
}

/*AddCustomerConflict handles this case with default header values.

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

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

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

func (o *AddCustomerConflict) 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
}

// NewAddCustomerInternalServerError creates a AddCustomerInternalServerError with default headers values
func NewAddCustomerInternalServerError() *AddCustomerInternalServerError {
	return &AddCustomerInternalServerError{}
}

/*AddCustomerInternalServerError handles this case with default header values.

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

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

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

func (o *AddCustomerInternalServerError) 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
}
