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

// PutPlansReader is a Reader for the PutPlans structure.
type PutPlansReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutPlansReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutPlansOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPutPlansBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPutPlansUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutPlansForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutPlansInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /plans] putPlans", response, response.Code())
	}
}

// NewPutPlansOK creates a PutPlansOK with default headers values
func NewPutPlansOK() *PutPlansOK {
	return &PutPlansOK{}
}

// PutPlansOK describes a response with status code 200, with default header values.
//
// Updated plans
type PutPlansOK struct {
	Payload *members_models.PlanResponse
}

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

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

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

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

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

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

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

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

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

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

// NewPutPlansBadRequest creates a PutPlansBadRequest with default headers values
func NewPutPlansBadRequest() *PutPlansBadRequest {
	return &PutPlansBadRequest{}
}

// PutPlansBadRequest describes a response with status code 400, with default header values.
//
// Invalid or immutable plan update
type PutPlansBadRequest struct {
}

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

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

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

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

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

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

func (o *PutPlansBadRequest) Error() string {
	return fmt.Sprintf("[PUT /plans][%d] putPlansBadRequest", 400)
}

func (o *PutPlansBadRequest) String() string {
	return fmt.Sprintf("[PUT /plans][%d] putPlansBadRequest", 400)
}

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

	return nil
}

// NewPutPlansUnauthorized creates a PutPlansUnauthorized with default headers values
func NewPutPlansUnauthorized() *PutPlansUnauthorized {
	return &PutPlansUnauthorized{}
}

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

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

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

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

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

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

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

func (o *PutPlansUnauthorized) Error() string {
	return fmt.Sprintf("[PUT /plans][%d] putPlansUnauthorized", 401)
}

func (o *PutPlansUnauthorized) String() string {
	return fmt.Sprintf("[PUT /plans][%d] putPlansUnauthorized", 401)
}

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

	return nil
}

// NewPutPlansForbidden creates a PutPlansForbidden with default headers values
func NewPutPlansForbidden() *PutPlansForbidden {
	return &PutPlansForbidden{}
}

// PutPlansForbidden describes a response with status code 403, with default header values.
//
// Actor lacks plan-management authority
type PutPlansForbidden struct {
}

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

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

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

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

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

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

func (o *PutPlansForbidden) Error() string {
	return fmt.Sprintf("[PUT /plans][%d] putPlansForbidden", 403)
}

func (o *PutPlansForbidden) String() string {
	return fmt.Sprintf("[PUT /plans][%d] putPlansForbidden", 403)
}

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

	return nil
}

// NewPutPlansInternalServerError creates a PutPlansInternalServerError with default headers values
func NewPutPlansInternalServerError() *PutPlansInternalServerError {
	return &PutPlansInternalServerError{}
}

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

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

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

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

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

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

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

func (o *PutPlansInternalServerError) Error() string {
	return fmt.Sprintf("[PUT /plans][%d] putPlansInternalServerError", 500)
}

func (o *PutPlansInternalServerError) String() string {
	return fmt.Sprintf("[PUT /plans][%d] putPlansInternalServerError", 500)
}

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

	return nil
}
