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

// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package rating_engine

// 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/taxnexus/go/lib/api/regs/regs_models"
)

// PostRatingEnginesReader is a Reader for the PostRatingEngines structure.
type PostRatingEnginesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostRatingEnginesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostRatingEnginesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostRatingEnginesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostRatingEnginesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostRatingEnginesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostRatingEnginesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostRatingEnginesInternalServerError()
		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())
	}
}

// NewPostRatingEnginesOK creates a PostRatingEnginesOK with default headers values
func NewPostRatingEnginesOK() *PostRatingEnginesOK {
	return &PostRatingEnginesOK{}
}

/*PostRatingEnginesOK handles this case with default header values.

Taxnexus Response with License objects
*/
type PostRatingEnginesOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *regs_models.LicenseTypeResponse
}

func (o *PostRatingEnginesOK) Error() string {
	return fmt.Sprintf("[POST /ratingengines][%d] postRatingEnginesOK  %+v", 200, o.Payload)
}

func (o *PostRatingEnginesOK) GetPayload() *regs_models.LicenseTypeResponse {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	// response header Cache-Control
	o.CacheControl = response.GetHeader("Cache-Control")

	o.Payload = new(regs_models.LicenseTypeResponse)

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

	return nil
}

// NewPostRatingEnginesUnauthorized creates a PostRatingEnginesUnauthorized with default headers values
func NewPostRatingEnginesUnauthorized() *PostRatingEnginesUnauthorized {
	return &PostRatingEnginesUnauthorized{}
}

/*PostRatingEnginesUnauthorized handles this case with default header values.

Access Unauthorized, invalid API-KEY was used
*/
type PostRatingEnginesUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *regs_models.Error
}

func (o *PostRatingEnginesUnauthorized) Error() string {
	return fmt.Sprintf("[POST /ratingengines][%d] postRatingEnginesUnauthorized  %+v", 401, o.Payload)
}

func (o *PostRatingEnginesUnauthorized) GetPayload() *regs_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(regs_models.Error)

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

	return nil
}

// NewPostRatingEnginesForbidden creates a PostRatingEnginesForbidden with default headers values
func NewPostRatingEnginesForbidden() *PostRatingEnginesForbidden {
	return &PostRatingEnginesForbidden{}
}

/*PostRatingEnginesForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type PostRatingEnginesForbidden struct {
	AccessControlAllowOrigin string

	Payload *regs_models.Error
}

func (o *PostRatingEnginesForbidden) Error() string {
	return fmt.Sprintf("[POST /ratingengines][%d] postRatingEnginesForbidden  %+v", 403, o.Payload)
}

func (o *PostRatingEnginesForbidden) GetPayload() *regs_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(regs_models.Error)

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

	return nil
}

// NewPostRatingEnginesNotFound creates a PostRatingEnginesNotFound with default headers values
func NewPostRatingEnginesNotFound() *PostRatingEnginesNotFound {
	return &PostRatingEnginesNotFound{}
}

/*PostRatingEnginesNotFound handles this case with default header values.

Resource was not found
*/
type PostRatingEnginesNotFound struct {
	AccessControlAllowOrigin string

	Payload *regs_models.Error
}

func (o *PostRatingEnginesNotFound) Error() string {
	return fmt.Sprintf("[POST /ratingengines][%d] postRatingEnginesNotFound  %+v", 404, o.Payload)
}

func (o *PostRatingEnginesNotFound) GetPayload() *regs_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(regs_models.Error)

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

	return nil
}

// NewPostRatingEnginesUnprocessableEntity creates a PostRatingEnginesUnprocessableEntity with default headers values
func NewPostRatingEnginesUnprocessableEntity() *PostRatingEnginesUnprocessableEntity {
	return &PostRatingEnginesUnprocessableEntity{}
}

/*PostRatingEnginesUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PostRatingEnginesUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *regs_models.Error
}

func (o *PostRatingEnginesUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /ratingengines][%d] postRatingEnginesUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *PostRatingEnginesUnprocessableEntity) GetPayload() *regs_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(regs_models.Error)

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

	return nil
}

// NewPostRatingEnginesInternalServerError creates a PostRatingEnginesInternalServerError with default headers values
func NewPostRatingEnginesInternalServerError() *PostRatingEnginesInternalServerError {
	return &PostRatingEnginesInternalServerError{}
}

/*PostRatingEnginesInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostRatingEnginesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *regs_models.Error
}

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

func (o *PostRatingEnginesInternalServerError) GetPayload() *regs_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(regs_models.Error)

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

	return nil
}
