// Code generated by go-swagger; DO NOT EDIT.

package org

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"encoding/json"
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"github.com/grafana/grafana-openapi-client-go/models"
)

// GetOrgUsersForCurrentOrgReader is a Reader for the GetOrgUsersForCurrentOrg structure.
type GetOrgUsersForCurrentOrgReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetOrgUsersForCurrentOrgReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetOrgUsersForCurrentOrgOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetOrgUsersForCurrentOrgUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetOrgUsersForCurrentOrgForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetOrgUsersForCurrentOrgInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /org/users] getOrgUsersForCurrentOrg", response, response.Code())
	}
}

// NewGetOrgUsersForCurrentOrgOK creates a GetOrgUsersForCurrentOrgOK with default headers values
func NewGetOrgUsersForCurrentOrgOK() *GetOrgUsersForCurrentOrgOK {
	return &GetOrgUsersForCurrentOrgOK{}
}

/*
GetOrgUsersForCurrentOrgOK describes a response with status code 200, with default header values.

(empty)
*/
type GetOrgUsersForCurrentOrgOK struct {
	Payload []*models.OrgUserDTO
}

// IsSuccess returns true when this get org users for current org Ok response has a 2xx status code
func (o *GetOrgUsersForCurrentOrgOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this get org users for current org Ok response has a 3xx status code
func (o *GetOrgUsersForCurrentOrgOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get org users for current org Ok response has a 4xx status code
func (o *GetOrgUsersForCurrentOrgOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this get org users for current org Ok response has a 5xx status code
func (o *GetOrgUsersForCurrentOrgOK) IsServerError() bool {
	return false
}

// IsCode returns true when this get org users for current org Ok response a status code equal to that given
func (o *GetOrgUsersForCurrentOrgOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the get org users for current org Ok response
func (o *GetOrgUsersForCurrentOrgOK) Code() int {
	return 200
}

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

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

func (o *GetOrgUsersForCurrentOrgOK) GetPayload() []*models.OrgUserDTO {
	return o.Payload
}

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

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

	return nil
}

// NewGetOrgUsersForCurrentOrgUnauthorized creates a GetOrgUsersForCurrentOrgUnauthorized with default headers values
func NewGetOrgUsersForCurrentOrgUnauthorized() *GetOrgUsersForCurrentOrgUnauthorized {
	return &GetOrgUsersForCurrentOrgUnauthorized{}
}

/*
GetOrgUsersForCurrentOrgUnauthorized describes a response with status code 401, with default header values.

UnauthorizedError is returned when the request is not authenticated.
*/
type GetOrgUsersForCurrentOrgUnauthorized struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this get org users for current org unauthorized response has a 2xx status code
func (o *GetOrgUsersForCurrentOrgUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get org users for current org unauthorized response has a 3xx status code
func (o *GetOrgUsersForCurrentOrgUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get org users for current org unauthorized response has a 4xx status code
func (o *GetOrgUsersForCurrentOrgUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this get org users for current org unauthorized response has a 5xx status code
func (o *GetOrgUsersForCurrentOrgUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this get org users for current org unauthorized response a status code equal to that given
func (o *GetOrgUsersForCurrentOrgUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the get org users for current org unauthorized response
func (o *GetOrgUsersForCurrentOrgUnauthorized) Code() int {
	return 401
}

func (o *GetOrgUsersForCurrentOrgUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /org/users][%d] getOrgUsersForCurrentOrgUnauthorized %s", 401, payload)
}

func (o *GetOrgUsersForCurrentOrgUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /org/users][%d] getOrgUsersForCurrentOrgUnauthorized %s", 401, payload)
}

func (o *GetOrgUsersForCurrentOrgUnauthorized) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}

// NewGetOrgUsersForCurrentOrgForbidden creates a GetOrgUsersForCurrentOrgForbidden with default headers values
func NewGetOrgUsersForCurrentOrgForbidden() *GetOrgUsersForCurrentOrgForbidden {
	return &GetOrgUsersForCurrentOrgForbidden{}
}

/*
GetOrgUsersForCurrentOrgForbidden describes a response with status code 403, with default header values.

ForbiddenError is returned if the user/token has insufficient permissions to access the requested resource.
*/
type GetOrgUsersForCurrentOrgForbidden struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this get org users for current org forbidden response has a 2xx status code
func (o *GetOrgUsersForCurrentOrgForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get org users for current org forbidden response has a 3xx status code
func (o *GetOrgUsersForCurrentOrgForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get org users for current org forbidden response has a 4xx status code
func (o *GetOrgUsersForCurrentOrgForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this get org users for current org forbidden response has a 5xx status code
func (o *GetOrgUsersForCurrentOrgForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this get org users for current org forbidden response a status code equal to that given
func (o *GetOrgUsersForCurrentOrgForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the get org users for current org forbidden response
func (o *GetOrgUsersForCurrentOrgForbidden) Code() int {
	return 403
}

func (o *GetOrgUsersForCurrentOrgForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /org/users][%d] getOrgUsersForCurrentOrgForbidden %s", 403, payload)
}

func (o *GetOrgUsersForCurrentOrgForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /org/users][%d] getOrgUsersForCurrentOrgForbidden %s", 403, payload)
}

func (o *GetOrgUsersForCurrentOrgForbidden) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}

// NewGetOrgUsersForCurrentOrgInternalServerError creates a GetOrgUsersForCurrentOrgInternalServerError with default headers values
func NewGetOrgUsersForCurrentOrgInternalServerError() *GetOrgUsersForCurrentOrgInternalServerError {
	return &GetOrgUsersForCurrentOrgInternalServerError{}
}

/*
GetOrgUsersForCurrentOrgInternalServerError describes a response with status code 500, with default header values.

InternalServerError is a general error indicating something went wrong internally.
*/
type GetOrgUsersForCurrentOrgInternalServerError struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this get org users for current org internal server error response has a 2xx status code
func (o *GetOrgUsersForCurrentOrgInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get org users for current org internal server error response has a 3xx status code
func (o *GetOrgUsersForCurrentOrgInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get org users for current org internal server error response has a 4xx status code
func (o *GetOrgUsersForCurrentOrgInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this get org users for current org internal server error response has a 5xx status code
func (o *GetOrgUsersForCurrentOrgInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this get org users for current org internal server error response a status code equal to that given
func (o *GetOrgUsersForCurrentOrgInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the get org users for current org internal server error response
func (o *GetOrgUsersForCurrentOrgInternalServerError) Code() int {
	return 500
}

func (o *GetOrgUsersForCurrentOrgInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /org/users][%d] getOrgUsersForCurrentOrgInternalServerError %s", 500, payload)
}

func (o *GetOrgUsersForCurrentOrgInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /org/users][%d] getOrgUsersForCurrentOrgInternalServerError %s", 500, payload)
}

func (o *GetOrgUsersForCurrentOrgInternalServerError) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}
