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

// PostTenantMembershipReader is a Reader for the PostTenantMembership structure.
type PostTenantMembershipReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostTenantMembershipReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPostTenantMembershipOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostTenantMembershipBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostTenantMembershipUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostTenantMembershipNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewPostTenantMembershipConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostTenantMembershipInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /tenantmemberships] postTenantMembership", response, response.Code())
	}
}

// NewPostTenantMembershipOK creates a PostTenantMembershipOK with default headers values
func NewPostTenantMembershipOK() *PostTenantMembershipOK {
	return &PostTenantMembershipOK{}
}

// PostTenantMembershipOK describes a response with status code 200, with default header values.
//
// Newly created membership or exact existing desired-state match
type PostTenantMembershipOK struct {
	Payload *members_models.TenantMembershipResponse
}

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

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

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

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

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

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

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

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

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

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

// NewPostTenantMembershipBadRequest creates a PostTenantMembershipBadRequest with default headers values
func NewPostTenantMembershipBadRequest() *PostTenantMembershipBadRequest {
	return &PostTenantMembershipBadRequest{}
}

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

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

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

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

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

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

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

func (o *PostTenantMembershipBadRequest) Error() string {
	return fmt.Sprintf("[POST /tenantmemberships][%d] postTenantMembershipBadRequest", 400)
}

func (o *PostTenantMembershipBadRequest) String() string {
	return fmt.Sprintf("[POST /tenantmemberships][%d] postTenantMembershipBadRequest", 400)
}

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

	return nil
}

// NewPostTenantMembershipUnauthorized creates a PostTenantMembershipUnauthorized with default headers values
func NewPostTenantMembershipUnauthorized() *PostTenantMembershipUnauthorized {
	return &PostTenantMembershipUnauthorized{}
}

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

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

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

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

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

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

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

func (o *PostTenantMembershipUnauthorized) Error() string {
	return fmt.Sprintf("[POST /tenantmemberships][%d] postTenantMembershipUnauthorized", 401)
}

func (o *PostTenantMembershipUnauthorized) String() string {
	return fmt.Sprintf("[POST /tenantmemberships][%d] postTenantMembershipUnauthorized", 401)
}

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

	return nil
}

// NewPostTenantMembershipNotFound creates a PostTenantMembershipNotFound with default headers values
func NewPostTenantMembershipNotFound() *PostTenantMembershipNotFound {
	return &PostTenantMembershipNotFound{}
}

// PostTenantMembershipNotFound describes a response with status code 404, with default header values.
//
// Target tenant, user, or authority is unavailable
type PostTenantMembershipNotFound struct {
}

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

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

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

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

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

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

func (o *PostTenantMembershipNotFound) Error() string {
	return fmt.Sprintf("[POST /tenantmemberships][%d] postTenantMembershipNotFound", 404)
}

func (o *PostTenantMembershipNotFound) String() string {
	return fmt.Sprintf("[POST /tenantmemberships][%d] postTenantMembershipNotFound", 404)
}

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

	return nil
}

// NewPostTenantMembershipConflict creates a PostTenantMembershipConflict with default headers values
func NewPostTenantMembershipConflict() *PostTenantMembershipConflict {
	return &PostTenantMembershipConflict{}
}

// PostTenantMembershipConflict describes a response with status code 409, with default header values.
//
// Self-change, owner, or existing-state conflict; use GET plus optimistic PUT for state changes
type PostTenantMembershipConflict struct {
}

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

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

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

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

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

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

func (o *PostTenantMembershipConflict) Error() string {
	return fmt.Sprintf("[POST /tenantmemberships][%d] postTenantMembershipConflict", 409)
}

func (o *PostTenantMembershipConflict) String() string {
	return fmt.Sprintf("[POST /tenantmemberships][%d] postTenantMembershipConflict", 409)
}

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

	return nil
}

// NewPostTenantMembershipInternalServerError creates a PostTenantMembershipInternalServerError with default headers values
func NewPostTenantMembershipInternalServerError() *PostTenantMembershipInternalServerError {
	return &PostTenantMembershipInternalServerError{}
}

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

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

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

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

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

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

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

func (o *PostTenantMembershipInternalServerError) Error() string {
	return fmt.Sprintf("[POST /tenantmemberships][%d] postTenantMembershipInternalServerError", 500)
}

func (o *PostTenantMembershipInternalServerError) String() string {
	return fmt.Sprintf("[POST /tenantmemberships][%d] postTenantMembershipInternalServerError", 500)
}

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

	return nil
}
