// 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"
)

// ListCustomersReader is a Reader for the ListCustomers structure.
type ListCustomersReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ListCustomersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewListCustomersOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 500:
		result := NewListCustomersInternalServerError()
		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())
	}
}

// NewListCustomersOK creates a ListCustomersOK with default headers values
func NewListCustomersOK() *ListCustomersOK {
	return &ListCustomersOK{}
}

/*ListCustomersOK handles this case with default header values.

List of customers in the system returned
*/
type ListCustomersOK struct {
	Payload []*models.Customer
}

func (o *ListCustomersOK) Error() string {
	return fmt.Sprintf("[GET /customer][%d] listCustomersOK  %+v", 200, o.Payload)
}

func (o *ListCustomersOK) GetPayload() []*models.Customer {
	return o.Payload
}

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

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

	return nil
}

// NewListCustomersInternalServerError creates a ListCustomersInternalServerError with default headers values
func NewListCustomersInternalServerError() *ListCustomersInternalServerError {
	return &ListCustomersInternalServerError{}
}

/*ListCustomersInternalServerError handles this case with default header values.

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

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

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

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