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

// PostPlanServicesReader is a Reader for the PostPlanServices structure.
type PostPlanServicesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostPlanServicesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPostPlanServicesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostPlanServicesBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostPlanServicesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostPlanServicesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostPlanServicesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /planservices] postPlanServices", response, response.Code())
	}
}

// NewPostPlanServicesOK creates a PostPlanServicesOK with default headers values
func NewPostPlanServicesOK() *PostPlanServicesOK {
	return &PostPlanServicesOK{}
}

// PostPlanServicesOK describes a response with status code 200, with default header values.
//
// Created plan-service records
type PostPlanServicesOK struct {
	Payload *members_models.PlanServiceResponse
}

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

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

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

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

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

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

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

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

func (o *PostPlanServicesOK) GetPayload() *members_models.PlanServiceResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.PlanServiceResponse)

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

	return nil
}

// NewPostPlanServicesBadRequest creates a PostPlanServicesBadRequest with default headers values
func NewPostPlanServicesBadRequest() *PostPlanServicesBadRequest {
	return &PostPlanServicesBadRequest{}
}

// PostPlanServicesBadRequest describes a response with status code 400, with default header values.
//
// Invalid typed limit or plan grant
type PostPlanServicesBadRequest struct {
}

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

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

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

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

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

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

func (o *PostPlanServicesBadRequest) Error() string {
	return fmt.Sprintf("[POST /planservices][%d] postPlanServicesBadRequest", 400)
}

func (o *PostPlanServicesBadRequest) String() string {
	return fmt.Sprintf("[POST /planservices][%d] postPlanServicesBadRequest", 400)
}

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

	return nil
}

// NewPostPlanServicesUnauthorized creates a PostPlanServicesUnauthorized with default headers values
func NewPostPlanServicesUnauthorized() *PostPlanServicesUnauthorized {
	return &PostPlanServicesUnauthorized{}
}

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

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

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

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

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

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

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

func (o *PostPlanServicesUnauthorized) Error() string {
	return fmt.Sprintf("[POST /planservices][%d] postPlanServicesUnauthorized", 401)
}

func (o *PostPlanServicesUnauthorized) String() string {
	return fmt.Sprintf("[POST /planservices][%d] postPlanServicesUnauthorized", 401)
}

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

	return nil
}

// NewPostPlanServicesForbidden creates a PostPlanServicesForbidden with default headers values
func NewPostPlanServicesForbidden() *PostPlanServicesForbidden {
	return &PostPlanServicesForbidden{}
}

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

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

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

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

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

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

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

func (o *PostPlanServicesForbidden) Error() string {
	return fmt.Sprintf("[POST /planservices][%d] postPlanServicesForbidden", 403)
}

func (o *PostPlanServicesForbidden) String() string {
	return fmt.Sprintf("[POST /planservices][%d] postPlanServicesForbidden", 403)
}

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

	return nil
}

// NewPostPlanServicesInternalServerError creates a PostPlanServicesInternalServerError with default headers values
func NewPostPlanServicesInternalServerError() *PostPlanServicesInternalServerError {
	return &PostPlanServicesInternalServerError{}
}

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

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

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

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

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

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

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

func (o *PostPlanServicesInternalServerError) Error() string {
	return fmt.Sprintf("[POST /planservices][%d] postPlanServicesInternalServerError", 500)
}

func (o *PostPlanServicesInternalServerError) String() string {
	return fmt.Sprintf("[POST /planservices][%d] postPlanServicesInternalServerError", 500)
}

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

	return nil
}
