// 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 license_type

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

// PostLicenseTypesReader is a Reader for the PostLicenseTypes structure.
type PostLicenseTypesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostLicenseTypesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostLicenseTypesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostLicenseTypesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostLicenseTypesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostLicenseTypesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostLicenseTypesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostLicenseTypesInternalServerError()
		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())
	}
}

// NewPostLicenseTypesOK creates a PostLicenseTypesOK with default headers values
func NewPostLicenseTypesOK() *PostLicenseTypesOK {
	return &PostLicenseTypesOK{}
}

/*PostLicenseTypesOK handles this case with default header values.

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

	CacheControl string

	Payload *regs_models.LicenseTypeResponse
}

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

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

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

// NewPostLicenseTypesUnauthorized creates a PostLicenseTypesUnauthorized with default headers values
func NewPostLicenseTypesUnauthorized() *PostLicenseTypesUnauthorized {
	return &PostLicenseTypesUnauthorized{}
}

/*PostLicenseTypesUnauthorized handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewPostLicenseTypesForbidden creates a PostLicenseTypesForbidden with default headers values
func NewPostLicenseTypesForbidden() *PostLicenseTypesForbidden {
	return &PostLicenseTypesForbidden{}
}

/*PostLicenseTypesForbidden handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewPostLicenseTypesNotFound creates a PostLicenseTypesNotFound with default headers values
func NewPostLicenseTypesNotFound() *PostLicenseTypesNotFound {
	return &PostLicenseTypesNotFound{}
}

/*PostLicenseTypesNotFound handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewPostLicenseTypesUnprocessableEntity creates a PostLicenseTypesUnprocessableEntity with default headers values
func NewPostLicenseTypesUnprocessableEntity() *PostLicenseTypesUnprocessableEntity {
	return &PostLicenseTypesUnprocessableEntity{}
}

/*PostLicenseTypesUnprocessableEntity handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewPostLicenseTypesInternalServerError creates a PostLicenseTypesInternalServerError with default headers values
func NewPostLicenseTypesInternalServerError() *PostLicenseTypesInternalServerError {
	return &PostLicenseTypesInternalServerError{}
}

/*PostLicenseTypesInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostLicenseTypesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *regs_models.Error
}

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

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

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