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

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

// GetPlansReader is a Reader for the GetPlans structure.
type GetPlansReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetPlansReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetPlansOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetPlansBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetPlansUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetPlansForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetPlansInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /plans] getPlans", response, response.Code())
	}
}

// NewGetPlansOK creates a GetPlansOK with default headers values
func NewGetPlansOK() *GetPlansOK {
	return &GetPlansOK{}
}

// GetPlansOK describes a response with status code 200, with default header values.
//
// Plan records
type GetPlansOK struct {
	Payload *members_models.PlanResponse
}

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

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

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

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

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

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

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

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

func (o *GetPlansOK) GetPayload() *members_models.PlanResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.PlanResponse)

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

	return nil
}

// NewGetPlansBadRequest creates a GetPlansBadRequest with default headers values
func NewGetPlansBadRequest() *GetPlansBadRequest {
	return &GetPlansBadRequest{}
}

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

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

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

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

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

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

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

func (o *GetPlansBadRequest) Error() string {
	return fmt.Sprintf("[GET /plans][%d] getPlansBadRequest", 400)
}

func (o *GetPlansBadRequest) String() string {
	return fmt.Sprintf("[GET /plans][%d] getPlansBadRequest", 400)
}

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

	return nil
}

// NewGetPlansUnauthorized creates a GetPlansUnauthorized with default headers values
func NewGetPlansUnauthorized() *GetPlansUnauthorized {
	return &GetPlansUnauthorized{}
}

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

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

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

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

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

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

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

func (o *GetPlansUnauthorized) Error() string {
	return fmt.Sprintf("[GET /plans][%d] getPlansUnauthorized", 401)
}

func (o *GetPlansUnauthorized) String() string {
	return fmt.Sprintf("[GET /plans][%d] getPlansUnauthorized", 401)
}

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

	return nil
}

// NewGetPlansForbidden creates a GetPlansForbidden with default headers values
func NewGetPlansForbidden() *GetPlansForbidden {
	return &GetPlansForbidden{}
}

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

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

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

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

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

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

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

func (o *GetPlansForbidden) Error() string {
	return fmt.Sprintf("[GET /plans][%d] getPlansForbidden", 403)
}

func (o *GetPlansForbidden) String() string {
	return fmt.Sprintf("[GET /plans][%d] getPlansForbidden", 403)
}

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

	return nil
}

// NewGetPlansInternalServerError creates a GetPlansInternalServerError with default headers values
func NewGetPlansInternalServerError() *GetPlansInternalServerError {
	return &GetPlansInternalServerError{}
}

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

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

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

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

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

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

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

func (o *GetPlansInternalServerError) Error() string {
	return fmt.Sprintf("[GET /plans][%d] getPlansInternalServerError", 500)
}

func (o *GetPlansInternalServerError) String() string {
	return fmt.Sprintf("[GET /plans][%d] getPlansInternalServerError", 500)
}

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

	return nil
}
