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

// PostEntitlementsReader is a Reader for the PostEntitlements structure.
type PostEntitlementsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostEntitlementsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPostEntitlementsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostEntitlementsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostEntitlementsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostEntitlementsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostEntitlementsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /entitlements] postEntitlements", response, response.Code())
	}
}

// NewPostEntitlementsOK creates a PostEntitlementsOK with default headers values
func NewPostEntitlementsOK() *PostEntitlementsOK {
	return &PostEntitlementsOK{}
}

// PostEntitlementsOK describes a response with status code 200, with default header values.
//
// Created entitlements
type PostEntitlementsOK struct {
	Payload *members_models.EntitlementResponse
}

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

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

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

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

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

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

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

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

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

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

// NewPostEntitlementsBadRequest creates a PostEntitlementsBadRequest with default headers values
func NewPostEntitlementsBadRequest() *PostEntitlementsBadRequest {
	return &PostEntitlementsBadRequest{}
}

// PostEntitlementsBadRequest describes a response with status code 400, with default header values.
//
// Invalid or overlapping explicit grant
type PostEntitlementsBadRequest struct {
}

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

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

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

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

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

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

func (o *PostEntitlementsBadRequest) Error() string {
	return fmt.Sprintf("[POST /entitlements][%d] postEntitlementsBadRequest", 400)
}

func (o *PostEntitlementsBadRequest) String() string {
	return fmt.Sprintf("[POST /entitlements][%d] postEntitlementsBadRequest", 400)
}

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

	return nil
}

// NewPostEntitlementsUnauthorized creates a PostEntitlementsUnauthorized with default headers values
func NewPostEntitlementsUnauthorized() *PostEntitlementsUnauthorized {
	return &PostEntitlementsUnauthorized{}
}

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

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

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

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

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

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

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

func (o *PostEntitlementsUnauthorized) Error() string {
	return fmt.Sprintf("[POST /entitlements][%d] postEntitlementsUnauthorized", 401)
}

func (o *PostEntitlementsUnauthorized) String() string {
	return fmt.Sprintf("[POST /entitlements][%d] postEntitlementsUnauthorized", 401)
}

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

	return nil
}

// NewPostEntitlementsForbidden creates a PostEntitlementsForbidden with default headers values
func NewPostEntitlementsForbidden() *PostEntitlementsForbidden {
	return &PostEntitlementsForbidden{}
}

// PostEntitlementsForbidden describes a response with status code 403, with default header values.
//
// Actor cannot manage grants for the tenant
type PostEntitlementsForbidden struct {
}

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

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

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

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

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

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

func (o *PostEntitlementsForbidden) Error() string {
	return fmt.Sprintf("[POST /entitlements][%d] postEntitlementsForbidden", 403)
}

func (o *PostEntitlementsForbidden) String() string {
	return fmt.Sprintf("[POST /entitlements][%d] postEntitlementsForbidden", 403)
}

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

	return nil
}

// NewPostEntitlementsInternalServerError creates a PostEntitlementsInternalServerError with default headers values
func NewPostEntitlementsInternalServerError() *PostEntitlementsInternalServerError {
	return &PostEntitlementsInternalServerError{}
}

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

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

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

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

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

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

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

func (o *PostEntitlementsInternalServerError) Error() string {
	return fmt.Sprintf("[POST /entitlements][%d] postEntitlementsInternalServerError", 500)
}

func (o *PostEntitlementsInternalServerError) String() string {
	return fmt.Sprintf("[POST /entitlements][%d] postEntitlementsInternalServerError", 500)
}

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

	return nil
}
