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

// GetTenantMembershipsReader is a Reader for the GetTenantMemberships structure.
type GetTenantMembershipsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetTenantMembershipsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetTenantMembershipsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetTenantMembershipsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetTenantMembershipsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetTenantMembershipsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetTenantMembershipsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /tenantmemberships] getTenantMemberships", response, response.Code())
	}
}

// NewGetTenantMembershipsOK creates a GetTenantMembershipsOK with default headers values
func NewGetTenantMembershipsOK() *GetTenantMembershipsOK {
	return &GetTenantMembershipsOK{}
}

// GetTenantMembershipsOK describes a response with status code 200, with default header values.
//
// Actor-scoped tenant memberships
type GetTenantMembershipsOK struct {
	Payload *members_models.TenantMembershipListResponse
}

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

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

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

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

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

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

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

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

func (o *GetTenantMembershipsOK) GetPayload() *members_models.TenantMembershipListResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.TenantMembershipListResponse)

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

	return nil
}

// NewGetTenantMembershipsBadRequest creates a GetTenantMembershipsBadRequest with default headers values
func NewGetTenantMembershipsBadRequest() *GetTenantMembershipsBadRequest {
	return &GetTenantMembershipsBadRequest{}
}

// GetTenantMembershipsBadRequest describes a response with status code 400, with default header values.
//
// Invalid membership filter
type GetTenantMembershipsBadRequest struct {
}

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

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

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

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

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

// Code gets the status code for the get tenant memberships bad request response
func (o *GetTenantMembershipsBadRequest) Code() int {
	return 400
}

func (o *GetTenantMembershipsBadRequest) Error() string {
	return fmt.Sprintf("[GET /tenantmemberships][%d] getTenantMembershipsBadRequest", 400)
}

func (o *GetTenantMembershipsBadRequest) String() string {
	return fmt.Sprintf("[GET /tenantmemberships][%d] getTenantMembershipsBadRequest", 400)
}

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

	return nil
}

// NewGetTenantMembershipsUnauthorized creates a GetTenantMembershipsUnauthorized with default headers values
func NewGetTenantMembershipsUnauthorized() *GetTenantMembershipsUnauthorized {
	return &GetTenantMembershipsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

	return nil
}

// NewGetTenantMembershipsNotFound creates a GetTenantMembershipsNotFound with default headers values
func NewGetTenantMembershipsNotFound() *GetTenantMembershipsNotFound {
	return &GetTenantMembershipsNotFound{}
}

// GetTenantMembershipsNotFound describes a response with status code 404, with default header values.
//
// Requested foreign or unavailable scope
type GetTenantMembershipsNotFound struct {
}

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

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

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

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

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

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

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

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

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

	return nil
}

// NewGetTenantMembershipsInternalServerError creates a GetTenantMembershipsInternalServerError with default headers values
func NewGetTenantMembershipsInternalServerError() *GetTenantMembershipsInternalServerError {
	return &GetTenantMembershipsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

	return nil
}
