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

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

package portal_access

import (
	"encoding/json"
	stderrors "errors"
	"fmt"
	"io"

	"code.tnxs.net/vernonkeenan/lib/api/members/members_models"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// GetEntitlementsReader is a Reader for the GetEntitlements structure.
type GetEntitlementsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetEntitlementsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetEntitlementsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetEntitlementsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetEntitlementsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetEntitlementsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetEntitlementsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /entitlements] getEntitlements", response, response.Code())
	}
}

// NewGetEntitlementsOK creates a GetEntitlementsOK with default headers values
func NewGetEntitlementsOK() *GetEntitlementsOK {
	return &GetEntitlementsOK{}
}

// GetEntitlementsOK describes a response with status code 200, with default header values.
//
// Authorized entitlement records
type GetEntitlementsOK struct {
	Payload *members_models.EntitlementResponse
}

// IsSuccess returns true when this get entitlements o k response has a 2xx status code
func (o *GetEntitlementsOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get entitlements o k response has a 3xx status code
func (o *GetEntitlementsOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get entitlements o k response has a 4xx status code
func (o *GetEntitlementsOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get entitlements o k response has a 5xx status code
func (o *GetEntitlementsOK) IsServerError() bool {
	return false
}

// IsCode returns true when this get entitlements o k response a status code equal to that given
func (o *GetEntitlementsOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the get entitlements o k response
func (o *GetEntitlementsOK) Code() int {
	return 200
}

func (o *GetEntitlementsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /entitlements][%d] getEntitlementsOK %s", 200, payload)
}

func (o *GetEntitlementsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /entitlements][%d] getEntitlementsOK %s", 200, payload)
}

func (o *GetEntitlementsOK) GetPayload() *members_models.EntitlementResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.EntitlementResponse)

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

	return nil
}

// NewGetEntitlementsBadRequest creates a GetEntitlementsBadRequest with default headers values
func NewGetEntitlementsBadRequest() *GetEntitlementsBadRequest {
	return &GetEntitlementsBadRequest{}
}

// GetEntitlementsBadRequest describes a response with status code 400, with default header values.
//
// Invalid entitlement filter
type GetEntitlementsBadRequest struct {
}

// IsSuccess returns true when this get entitlements bad request response has a 2xx status code
func (o *GetEntitlementsBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get entitlements bad request response has a 3xx status code
func (o *GetEntitlementsBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get entitlements bad request response has a 4xx status code
func (o *GetEntitlementsBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this get entitlements bad request response has a 5xx status code
func (o *GetEntitlementsBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this get entitlements bad request response a status code equal to that given
func (o *GetEntitlementsBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the get entitlements bad request response
func (o *GetEntitlementsBadRequest) Code() int {
	return 400
}

func (o *GetEntitlementsBadRequest) Error() string {
	return fmt.Sprintf("[GET /entitlements][%d] getEntitlementsBadRequest", 400)
}

func (o *GetEntitlementsBadRequest) String() string {
	return fmt.Sprintf("[GET /entitlements][%d] getEntitlementsBadRequest", 400)
}

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

	return nil
}

// NewGetEntitlementsUnauthorized creates a GetEntitlementsUnauthorized with default headers values
func NewGetEntitlementsUnauthorized() *GetEntitlementsUnauthorized {
	return &GetEntitlementsUnauthorized{}
}

// GetEntitlementsUnauthorized describes a response with status code 401, with default header values.
//
// Missing or invalid server or session credential
type GetEntitlementsUnauthorized struct {
}

// IsSuccess returns true when this get entitlements unauthorized response has a 2xx status code
func (o *GetEntitlementsUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get entitlements unauthorized response has a 3xx status code
func (o *GetEntitlementsUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get entitlements unauthorized response has a 4xx status code
func (o *GetEntitlementsUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this get entitlements unauthorized response has a 5xx status code
func (o *GetEntitlementsUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this get entitlements unauthorized response a status code equal to that given
func (o *GetEntitlementsUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the get entitlements unauthorized response
func (o *GetEntitlementsUnauthorized) Code() int {
	return 401
}

func (o *GetEntitlementsUnauthorized) Error() string {
	return fmt.Sprintf("[GET /entitlements][%d] getEntitlementsUnauthorized", 401)
}

func (o *GetEntitlementsUnauthorized) String() string {
	return fmt.Sprintf("[GET /entitlements][%d] getEntitlementsUnauthorized", 401)
}

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

	return nil
}

// NewGetEntitlementsForbidden creates a GetEntitlementsForbidden with default headers values
func NewGetEntitlementsForbidden() *GetEntitlementsForbidden {
	return &GetEntitlementsForbidden{}
}

// GetEntitlementsForbidden describes a response with status code 403, with default header values.
//
// Actor is not authorized for the tenant or user scope
type GetEntitlementsForbidden struct {
}

// IsSuccess returns true when this get entitlements forbidden response has a 2xx status code
func (o *GetEntitlementsForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get entitlements forbidden response has a 3xx status code
func (o *GetEntitlementsForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get entitlements forbidden response has a 4xx status code
func (o *GetEntitlementsForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this get entitlements forbidden response has a 5xx status code
func (o *GetEntitlementsForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this get entitlements forbidden response a status code equal to that given
func (o *GetEntitlementsForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the get entitlements forbidden response
func (o *GetEntitlementsForbidden) Code() int {
	return 403
}

func (o *GetEntitlementsForbidden) Error() string {
	return fmt.Sprintf("[GET /entitlements][%d] getEntitlementsForbidden", 403)
}

func (o *GetEntitlementsForbidden) String() string {
	return fmt.Sprintf("[GET /entitlements][%d] getEntitlementsForbidden", 403)
}

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

	return nil
}

// NewGetEntitlementsInternalServerError creates a GetEntitlementsInternalServerError with default headers values
func NewGetEntitlementsInternalServerError() *GetEntitlementsInternalServerError {
	return &GetEntitlementsInternalServerError{}
}

// GetEntitlementsInternalServerError describes a response with status code 500, with default header values.
//
// Server error
type GetEntitlementsInternalServerError struct {
}

// IsSuccess returns true when this get entitlements internal server error response has a 2xx status code
func (o *GetEntitlementsInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get entitlements internal server error response has a 3xx status code
func (o *GetEntitlementsInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get entitlements internal server error response has a 4xx status code
func (o *GetEntitlementsInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this get entitlements internal server error response has a 5xx status code
func (o *GetEntitlementsInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this get entitlements internal server error response a status code equal to that given
func (o *GetEntitlementsInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the get entitlements internal server error response
func (o *GetEntitlementsInternalServerError) Code() int {
	return 500
}

func (o *GetEntitlementsInternalServerError) Error() string {
	return fmt.Sprintf("[GET /entitlements][%d] getEntitlementsInternalServerError", 500)
}

func (o *GetEntitlementsInternalServerError) String() string {
	return fmt.Sprintf("[GET /entitlements][%d] getEntitlementsInternalServerError", 500)
}

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

	return nil
}
