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

// GetLicenseTypesReader is a Reader for the GetLicenseTypes structure.
type GetLicenseTypesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetLicenseTypesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetLicenseTypesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetLicenseTypesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetLicenseTypesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetLicenseTypesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetLicenseTypesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetLicenseTypesInternalServerError()
		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())
	}
}

// NewGetLicenseTypesOK creates a GetLicenseTypesOK with default headers values
func NewGetLicenseTypesOK() *GetLicenseTypesOK {
	return &GetLicenseTypesOK{}
}

/*GetLicenseTypesOK handles this case with default header values.

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

	CacheControl string

	Payload *regs_models.LicenseTypeResponse
}

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

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

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

// NewGetLicenseTypesUnauthorized creates a GetLicenseTypesUnauthorized with default headers values
func NewGetLicenseTypesUnauthorized() *GetLicenseTypesUnauthorized {
	return &GetLicenseTypesUnauthorized{}
}

/*GetLicenseTypesUnauthorized handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewGetLicenseTypesForbidden creates a GetLicenseTypesForbidden with default headers values
func NewGetLicenseTypesForbidden() *GetLicenseTypesForbidden {
	return &GetLicenseTypesForbidden{}
}

/*GetLicenseTypesForbidden handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewGetLicenseTypesNotFound creates a GetLicenseTypesNotFound with default headers values
func NewGetLicenseTypesNotFound() *GetLicenseTypesNotFound {
	return &GetLicenseTypesNotFound{}
}

/*GetLicenseTypesNotFound handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewGetLicenseTypesUnprocessableEntity creates a GetLicenseTypesUnprocessableEntity with default headers values
func NewGetLicenseTypesUnprocessableEntity() *GetLicenseTypesUnprocessableEntity {
	return &GetLicenseTypesUnprocessableEntity{}
}

/*GetLicenseTypesUnprocessableEntity handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewGetLicenseTypesInternalServerError creates a GetLicenseTypesInternalServerError with default headers values
func NewGetLicenseTypesInternalServerError() *GetLicenseTypesInternalServerError {
	return &GetLicenseTypesInternalServerError{}
}

/*GetLicenseTypesInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetLicenseTypesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *regs_models.Error
}

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

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

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