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

// PostPlansReader is a Reader for the PostPlans structure.
type PostPlansReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostPlansReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPostPlansOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostPlansBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostPlansUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostPlansForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostPlansInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /plans] postPlans", response, response.Code())
	}
}

// NewPostPlansOK creates a PostPlansOK with default headers values
func NewPostPlansOK() *PostPlansOK {
	return &PostPlansOK{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostPlansBadRequest creates a PostPlansBadRequest with default headers values
func NewPostPlansBadRequest() *PostPlansBadRequest {
	return &PostPlansBadRequest{}
}

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

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

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

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

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

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

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

func (o *PostPlansBadRequest) Error() string {
	return fmt.Sprintf("[POST /plans][%d] postPlansBadRequest", 400)
}

func (o *PostPlansBadRequest) String() string {
	return fmt.Sprintf("[POST /plans][%d] postPlansBadRequest", 400)
}

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

	return nil
}

// NewPostPlansUnauthorized creates a PostPlansUnauthorized with default headers values
func NewPostPlansUnauthorized() *PostPlansUnauthorized {
	return &PostPlansUnauthorized{}
}

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

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

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

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

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

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

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

func (o *PostPlansUnauthorized) Error() string {
	return fmt.Sprintf("[POST /plans][%d] postPlansUnauthorized", 401)
}

func (o *PostPlansUnauthorized) String() string {
	return fmt.Sprintf("[POST /plans][%d] postPlansUnauthorized", 401)
}

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

	return nil
}

// NewPostPlansForbidden creates a PostPlansForbidden with default headers values
func NewPostPlansForbidden() *PostPlansForbidden {
	return &PostPlansForbidden{}
}

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

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

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

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

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

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

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

func (o *PostPlansForbidden) Error() string {
	return fmt.Sprintf("[POST /plans][%d] postPlansForbidden", 403)
}

func (o *PostPlansForbidden) String() string {
	return fmt.Sprintf("[POST /plans][%d] postPlansForbidden", 403)
}

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

	return nil
}

// NewPostPlansInternalServerError creates a PostPlansInternalServerError with default headers values
func NewPostPlansInternalServerError() *PostPlansInternalServerError {
	return &PostPlansInternalServerError{}
}

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

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

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

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

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

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

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

func (o *PostPlansInternalServerError) Error() string {
	return fmt.Sprintf("[POST /plans][%d] postPlansInternalServerError", 500)
}

func (o *PostPlansInternalServerError) String() string {
	return fmt.Sprintf("[POST /plans][%d] postPlansInternalServerError", 500)
}

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

	return nil
}
