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

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

// PutTenantMembershipReader is a Reader for the PutTenantMembership structure.
type PutTenantMembershipReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutTenantMembershipReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutTenantMembershipOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPutTenantMembershipBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPutTenantMembershipUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutTenantMembershipNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewPutTenantMembershipConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutTenantMembershipInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /tenantmemberships/{membershipId}] putTenantMembership", response, response.Code())
	}
}

// NewPutTenantMembershipOK creates a PutTenantMembershipOK with default headers values
func NewPutTenantMembershipOK() *PutTenantMembershipOK {
	return &PutTenantMembershipOK{}
}

// PutTenantMembershipOK describes a response with status code 200, with default header values.
//
// Current membership desired state
type PutTenantMembershipOK struct {
	Payload *members_models.TenantMembershipResponse
}

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

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

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

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

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

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

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

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

func (o *PutTenantMembershipOK) GetPayload() *members_models.TenantMembershipResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.TenantMembershipResponse)

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

	return nil
}

// NewPutTenantMembershipBadRequest creates a PutTenantMembershipBadRequest with default headers values
func NewPutTenantMembershipBadRequest() *PutTenantMembershipBadRequest {
	return &PutTenantMembershipBadRequest{}
}

// PutTenantMembershipBadRequest describes a response with status code 400, with default header values.
//
// Invalid desired state
type PutTenantMembershipBadRequest struct {
}

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

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

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

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

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

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

func (o *PutTenantMembershipBadRequest) Error() string {
	return fmt.Sprintf("[PUT /tenantmemberships/{membershipId}][%d] putTenantMembershipBadRequest", 400)
}

func (o *PutTenantMembershipBadRequest) String() string {
	return fmt.Sprintf("[PUT /tenantmemberships/{membershipId}][%d] putTenantMembershipBadRequest", 400)
}

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

	return nil
}

// NewPutTenantMembershipUnauthorized creates a PutTenantMembershipUnauthorized with default headers values
func NewPutTenantMembershipUnauthorized() *PutTenantMembershipUnauthorized {
	return &PutTenantMembershipUnauthorized{}
}

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

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

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

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

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

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

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

func (o *PutTenantMembershipUnauthorized) Error() string {
	return fmt.Sprintf("[PUT /tenantmemberships/{membershipId}][%d] putTenantMembershipUnauthorized", 401)
}

func (o *PutTenantMembershipUnauthorized) String() string {
	return fmt.Sprintf("[PUT /tenantmemberships/{membershipId}][%d] putTenantMembershipUnauthorized", 401)
}

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

	return nil
}

// NewPutTenantMembershipNotFound creates a PutTenantMembershipNotFound with default headers values
func NewPutTenantMembershipNotFound() *PutTenantMembershipNotFound {
	return &PutTenantMembershipNotFound{}
}

// PutTenantMembershipNotFound describes a response with status code 404, with default header values.
//
// Membership is absent, foreign, or unauthorized
type PutTenantMembershipNotFound struct {
}

// IsSuccess returns true when this put tenant membership not found response has a 2xx status code
func (o *PutTenantMembershipNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put tenant membership not found response has a 3xx status code
func (o *PutTenantMembershipNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put tenant membership not found response has a 4xx status code
func (o *PutTenantMembershipNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this put tenant membership not found response has a 5xx status code
func (o *PutTenantMembershipNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this put tenant membership not found response a status code equal to that given
func (o *PutTenantMembershipNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the put tenant membership not found response
func (o *PutTenantMembershipNotFound) Code() int {
	return 404
}

func (o *PutTenantMembershipNotFound) Error() string {
	return fmt.Sprintf("[PUT /tenantmemberships/{membershipId}][%d] putTenantMembershipNotFound", 404)
}

func (o *PutTenantMembershipNotFound) String() string {
	return fmt.Sprintf("[PUT /tenantmemberships/{membershipId}][%d] putTenantMembershipNotFound", 404)
}

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

	return nil
}

// NewPutTenantMembershipConflict creates a PutTenantMembershipConflict with default headers values
func NewPutTenantMembershipConflict() *PutTenantMembershipConflict {
	return &PutTenantMembershipConflict{}
}

// PutTenantMembershipConflict describes a response with status code 409, with default header values.
//
// Optimistic, self-change, owner, or state conflict
type PutTenantMembershipConflict struct {
}

// IsSuccess returns true when this put tenant membership conflict response has a 2xx status code
func (o *PutTenantMembershipConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put tenant membership conflict response has a 3xx status code
func (o *PutTenantMembershipConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put tenant membership conflict response has a 4xx status code
func (o *PutTenantMembershipConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this put tenant membership conflict response has a 5xx status code
func (o *PutTenantMembershipConflict) IsServerError() bool {
	return false
}

// IsCode returns true when this put tenant membership conflict response a status code equal to that given
func (o *PutTenantMembershipConflict) IsCode(code int) bool {
	return code == 409
}

// Code gets the status code for the put tenant membership conflict response
func (o *PutTenantMembershipConflict) Code() int {
	return 409
}

func (o *PutTenantMembershipConflict) Error() string {
	return fmt.Sprintf("[PUT /tenantmemberships/{membershipId}][%d] putTenantMembershipConflict", 409)
}

func (o *PutTenantMembershipConflict) String() string {
	return fmt.Sprintf("[PUT /tenantmemberships/{membershipId}][%d] putTenantMembershipConflict", 409)
}

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

	return nil
}

// NewPutTenantMembershipInternalServerError creates a PutTenantMembershipInternalServerError with default headers values
func NewPutTenantMembershipInternalServerError() *PutTenantMembershipInternalServerError {
	return &PutTenantMembershipInternalServerError{}
}

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

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

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

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

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

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

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

func (o *PutTenantMembershipInternalServerError) Error() string {
	return fmt.Sprintf("[PUT /tenantmemberships/{membershipId}][%d] putTenantMembershipInternalServerError", 500)
}

func (o *PutTenantMembershipInternalServerError) String() string {
	return fmt.Sprintf("[PUT /tenantmemberships/{membershipId}][%d] putTenantMembershipInternalServerError", 500)
}

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

	return nil
}
