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

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

// AddResellerReader is a Reader for the AddReseller structure.
type AddResellerReader struct {
	formats strfmt.Registry
}

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

// NewAddResellerCreated creates a AddResellerCreated with default headers values
func NewAddResellerCreated() *AddResellerCreated {
	return &AddResellerCreated{}
}

/*AddResellerCreated handles this case with default header values.

New reseller was added successfully
*/
type AddResellerCreated struct {
	Payload *models.ItemCreatedResponse
}

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

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

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

// NewAddResellerAccepted creates a AddResellerAccepted with default headers values
func NewAddResellerAccepted() *AddResellerAccepted {
	return &AddResellerAccepted{}
}

/*AddResellerAccepted handles this case with default header values.

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

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

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

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

// NewAddResellerBadRequest creates a AddResellerBadRequest with default headers values
func NewAddResellerBadRequest() *AddResellerBadRequest {
	return &AddResellerBadRequest{}
}

/*AddResellerBadRequest handles this case with default header values.

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

func (o *AddResellerBadRequest) Error() string {
	return fmt.Sprintf("[POST /reseller][%d] addResellerBadRequest ", 400)
}

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

	return nil
}

// NewAddResellerConflict creates a AddResellerConflict with default headers values
func NewAddResellerConflict() *AddResellerConflict {
	return &AddResellerConflict{}
}

/*AddResellerConflict handles this case with default header values.

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

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

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

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

// NewAddResellerInternalServerError creates a AddResellerInternalServerError with default headers values
func NewAddResellerInternalServerError() *AddResellerInternalServerError {
	return &AddResellerInternalServerError{}
}

/*AddResellerInternalServerError handles this case with default header values.

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

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

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

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