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

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

// GetLicensesReader is a Reader for the GetLicenses structure.
type GetLicensesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetLicensesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetLicensesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetLicensesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetLicensesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetLicensesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetLicensesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetLicensesInternalServerError()
		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())
	}
}

// NewGetLicensesOK creates a GetLicensesOK with default headers values
func NewGetLicensesOK() *GetLicensesOK {
	return &GetLicensesOK{}
}

/*GetLicensesOK handles this case with default header values.

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

	CacheControl string

	Payload *regs_models.LicenseResponse
}

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

func (o *GetLicensesOK) GetPayload() *regs_models.LicenseResponse {
	return o.Payload
}

func (o *GetLicensesOK) 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.LicenseResponse)

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

	return nil
}

// NewGetLicensesUnauthorized creates a GetLicensesUnauthorized with default headers values
func NewGetLicensesUnauthorized() *GetLicensesUnauthorized {
	return &GetLicensesUnauthorized{}
}

/*GetLicensesUnauthorized handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewGetLicensesForbidden creates a GetLicensesForbidden with default headers values
func NewGetLicensesForbidden() *GetLicensesForbidden {
	return &GetLicensesForbidden{}
}

/*GetLicensesForbidden handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewGetLicensesNotFound creates a GetLicensesNotFound with default headers values
func NewGetLicensesNotFound() *GetLicensesNotFound {
	return &GetLicensesNotFound{}
}

/*GetLicensesNotFound handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewGetLicensesUnprocessableEntity creates a GetLicensesUnprocessableEntity with default headers values
func NewGetLicensesUnprocessableEntity() *GetLicensesUnprocessableEntity {
	return &GetLicensesUnprocessableEntity{}
}

/*GetLicensesUnprocessableEntity handles this case with default header values.

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

	Payload *regs_models.Error
}

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

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

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

// NewGetLicensesInternalServerError creates a GetLicensesInternalServerError with default headers values
func NewGetLicensesInternalServerError() *GetLicensesInternalServerError {
	return &GetLicensesInternalServerError{}
}

/*GetLicensesInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetLicensesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *regs_models.Error
}

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

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

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