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

// AddOrgUserToCurrentOrgReader is a Reader for the AddOrgUserToCurrentOrg structure.
type AddOrgUserToCurrentOrgReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *AddOrgUserToCurrentOrgReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewAddOrgUserToCurrentOrgOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewAddOrgUserToCurrentOrgUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewAddOrgUserToCurrentOrgForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewAddOrgUserToCurrentOrgInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /org/users] addOrgUserToCurrentOrg", response, response.Code())
	}
}

// NewAddOrgUserToCurrentOrgOK creates a AddOrgUserToCurrentOrgOK with default headers values
func NewAddOrgUserToCurrentOrgOK() *AddOrgUserToCurrentOrgOK {
	return &AddOrgUserToCurrentOrgOK{}
}

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

An OKResponse is returned if the request was successful.
*/
type AddOrgUserToCurrentOrgOK struct {
	Payload *models.SuccessResponseBody
}

// IsSuccess returns true when this add org user to current org Ok response has a 2xx status code
func (o *AddOrgUserToCurrentOrgOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this add org user to current org Ok response has a 3xx status code
func (o *AddOrgUserToCurrentOrgOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this add org user to current org Ok response has a 4xx status code
func (o *AddOrgUserToCurrentOrgOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this add org user to current org Ok response has a 5xx status code
func (o *AddOrgUserToCurrentOrgOK) IsServerError() bool {
	return false
}

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

// Code gets the status code for the add org user to current org Ok response
func (o *AddOrgUserToCurrentOrgOK) Code() int {
	return 200
}

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

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

func (o *AddOrgUserToCurrentOrgOK) GetPayload() *models.SuccessResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.SuccessResponseBody)

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

	return nil
}

// NewAddOrgUserToCurrentOrgUnauthorized creates a AddOrgUserToCurrentOrgUnauthorized with default headers values
func NewAddOrgUserToCurrentOrgUnauthorized() *AddOrgUserToCurrentOrgUnauthorized {
	return &AddOrgUserToCurrentOrgUnauthorized{}
}

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

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

// IsSuccess returns true when this add org user to current org unauthorized response has a 2xx status code
func (o *AddOrgUserToCurrentOrgUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this add org user to current org unauthorized response has a 3xx status code
func (o *AddOrgUserToCurrentOrgUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this add org user to current org unauthorized response has a 4xx status code
func (o *AddOrgUserToCurrentOrgUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this add org user to current org unauthorized response has a 5xx status code
func (o *AddOrgUserToCurrentOrgUnauthorized) IsServerError() bool {
	return false
}

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

// Code gets the status code for the add org user to current org unauthorized response
func (o *AddOrgUserToCurrentOrgUnauthorized) Code() int {
	return 401
}

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

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

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

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

// NewAddOrgUserToCurrentOrgForbidden creates a AddOrgUserToCurrentOrgForbidden with default headers values
func NewAddOrgUserToCurrentOrgForbidden() *AddOrgUserToCurrentOrgForbidden {
	return &AddOrgUserToCurrentOrgForbidden{}
}

/*
AddOrgUserToCurrentOrgForbidden 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 AddOrgUserToCurrentOrgForbidden struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this add org user to current org forbidden response has a 2xx status code
func (o *AddOrgUserToCurrentOrgForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this add org user to current org forbidden response has a 3xx status code
func (o *AddOrgUserToCurrentOrgForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this add org user to current org forbidden response has a 4xx status code
func (o *AddOrgUserToCurrentOrgForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this add org user to current org forbidden response has a 5xx status code
func (o *AddOrgUserToCurrentOrgForbidden) IsServerError() bool {
	return false
}

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

// Code gets the status code for the add org user to current org forbidden response
func (o *AddOrgUserToCurrentOrgForbidden) Code() int {
	return 403
}

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

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

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

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

// NewAddOrgUserToCurrentOrgInternalServerError creates a AddOrgUserToCurrentOrgInternalServerError with default headers values
func NewAddOrgUserToCurrentOrgInternalServerError() *AddOrgUserToCurrentOrgInternalServerError {
	return &AddOrgUserToCurrentOrgInternalServerError{}
}

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

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

// IsSuccess returns true when this add org user to current org internal server error response has a 2xx status code
func (o *AddOrgUserToCurrentOrgInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this add org user to current org internal server error response has a 3xx status code
func (o *AddOrgUserToCurrentOrgInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this add org user to current org internal server error response has a 4xx status code
func (o *AddOrgUserToCurrentOrgInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this add org user to current org internal server error response has a 5xx status code
func (o *AddOrgUserToCurrentOrgInternalServerError) IsServerError() bool {
	return true
}

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

// Code gets the status code for the add org user to current org internal server error response
func (o *AddOrgUserToCurrentOrgInternalServerError) Code() int {
	return 500
}

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

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

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

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