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

// GetTenantMembershipReader is a Reader for the GetTenantMembership structure.
type GetTenantMembershipReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetTenantMembershipReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetTenantMembershipOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetTenantMembershipUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetTenantMembershipNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetTenantMembershipInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /tenantmemberships/{membershipId}] getTenantMembership", response, response.Code())
	}
}

// NewGetTenantMembershipOK creates a GetTenantMembershipOK with default headers values
func NewGetTenantMembershipOK() *GetTenantMembershipOK {
	return &GetTenantMembershipOK{}
}

// GetTenantMembershipOK describes a response with status code 200, with default header values.
//
// Tenant membership
type GetTenantMembershipOK struct {
	Payload *members_models.TenantMembershipResponse
}

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

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

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

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

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

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

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

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

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

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

// NewGetTenantMembershipUnauthorized creates a GetTenantMembershipUnauthorized with default headers values
func NewGetTenantMembershipUnauthorized() *GetTenantMembershipUnauthorized {
	return &GetTenantMembershipUnauthorized{}
}

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

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

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

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

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

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

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

func (o *GetTenantMembershipUnauthorized) Error() string {
	return fmt.Sprintf("[GET /tenantmemberships/{membershipId}][%d] getTenantMembershipUnauthorized", 401)
}

func (o *GetTenantMembershipUnauthorized) String() string {
	return fmt.Sprintf("[GET /tenantmemberships/{membershipId}][%d] getTenantMembershipUnauthorized", 401)
}

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

	return nil
}

// NewGetTenantMembershipNotFound creates a GetTenantMembershipNotFound with default headers values
func NewGetTenantMembershipNotFound() *GetTenantMembershipNotFound {
	return &GetTenantMembershipNotFound{}
}

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

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

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

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

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

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

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

func (o *GetTenantMembershipNotFound) Error() string {
	return fmt.Sprintf("[GET /tenantmemberships/{membershipId}][%d] getTenantMembershipNotFound", 404)
}

func (o *GetTenantMembershipNotFound) String() string {
	return fmt.Sprintf("[GET /tenantmemberships/{membershipId}][%d] getTenantMembershipNotFound", 404)
}

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

	return nil
}

// NewGetTenantMembershipInternalServerError creates a GetTenantMembershipInternalServerError with default headers values
func NewGetTenantMembershipInternalServerError() *GetTenantMembershipInternalServerError {
	return &GetTenantMembershipInternalServerError{}
}

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

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

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

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

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

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

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

func (o *GetTenantMembershipInternalServerError) Error() string {
	return fmt.Sprintf("[GET /tenantmemberships/{membershipId}][%d] getTenantMembershipInternalServerError", 500)
}

func (o *GetTenantMembershipInternalServerError) String() string {
	return fmt.Sprintf("[GET /tenantmemberships/{membershipId}][%d] getTenantMembershipInternalServerError", 500)
}

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

	return nil
}
