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

package organization

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

	"src.opensuse.org/autogits/common/gitea-generated/models"
)

// OrgGetUserPermissionsReader is a Reader for the OrgGetUserPermissions structure.
type OrgGetUserPermissionsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *OrgGetUserPermissionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewOrgGetUserPermissionsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewOrgGetUserPermissionsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewOrgGetUserPermissionsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /users/{username}/orgs/{org}/permissions] orgGetUserPermissions", response, response.Code())
	}
}

// NewOrgGetUserPermissionsOK creates a OrgGetUserPermissionsOK with default headers values
func NewOrgGetUserPermissionsOK() *OrgGetUserPermissionsOK {
	return &OrgGetUserPermissionsOK{}
}

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

OrganizationPermissions
*/
type OrgGetUserPermissionsOK struct {
	Payload *models.OrganizationPermissions
}

// IsSuccess returns true when this org get user permissions o k response has a 2xx status code
func (o *OrgGetUserPermissionsOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this org get user permissions o k response has a 3xx status code
func (o *OrgGetUserPermissionsOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this org get user permissions o k response has a 4xx status code
func (o *OrgGetUserPermissionsOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this org get user permissions o k response has a 5xx status code
func (o *OrgGetUserPermissionsOK) IsServerError() bool {
	return false
}

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

// Code gets the status code for the org get user permissions o k response
func (o *OrgGetUserPermissionsOK) Code() int {
	return 200
}

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

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

func (o *OrgGetUserPermissionsOK) GetPayload() *models.OrganizationPermissions {
	return o.Payload
}

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

	o.Payload = new(models.OrganizationPermissions)

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

	return nil
}

// NewOrgGetUserPermissionsForbidden creates a OrgGetUserPermissionsForbidden with default headers values
func NewOrgGetUserPermissionsForbidden() *OrgGetUserPermissionsForbidden {
	return &OrgGetUserPermissionsForbidden{}
}

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

APIForbiddenError is a forbidden error response
*/
type OrgGetUserPermissionsForbidden struct {
	Message string
	URL     string
}

// IsSuccess returns true when this org get user permissions forbidden response has a 2xx status code
func (o *OrgGetUserPermissionsForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this org get user permissions forbidden response has a 3xx status code
func (o *OrgGetUserPermissionsForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this org get user permissions forbidden response has a 4xx status code
func (o *OrgGetUserPermissionsForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this org get user permissions forbidden response has a 5xx status code
func (o *OrgGetUserPermissionsForbidden) IsServerError() bool {
	return false
}

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

// Code gets the status code for the org get user permissions forbidden response
func (o *OrgGetUserPermissionsForbidden) Code() int {
	return 403
}

func (o *OrgGetUserPermissionsForbidden) Error() string {
	return fmt.Sprintf("[GET /users/{username}/orgs/{org}/permissions][%d] orgGetUserPermissionsForbidden", 403)
}

func (o *OrgGetUserPermissionsForbidden) String() string {
	return fmt.Sprintf("[GET /users/{username}/orgs/{org}/permissions][%d] orgGetUserPermissionsForbidden", 403)
}

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

	// hydrates response header message
	hdrMessage := response.GetHeader("message")

	if hdrMessage != "" {
		o.Message = hdrMessage
	}

	// hydrates response header url
	hdrURL := response.GetHeader("url")

	if hdrURL != "" {
		o.URL = hdrURL
	}

	return nil
}

// NewOrgGetUserPermissionsNotFound creates a OrgGetUserPermissionsNotFound with default headers values
func NewOrgGetUserPermissionsNotFound() *OrgGetUserPermissionsNotFound {
	return &OrgGetUserPermissionsNotFound{}
}

/*
OrgGetUserPermissionsNotFound describes a response with status code 404, with default header values.

APINotFound is a not found empty response
*/
type OrgGetUserPermissionsNotFound struct {
}

// IsSuccess returns true when this org get user permissions not found response has a 2xx status code
func (o *OrgGetUserPermissionsNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this org get user permissions not found response has a 3xx status code
func (o *OrgGetUserPermissionsNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this org get user permissions not found response has a 4xx status code
func (o *OrgGetUserPermissionsNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this org get user permissions not found response has a 5xx status code
func (o *OrgGetUserPermissionsNotFound) IsServerError() bool {
	return false
}

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

// Code gets the status code for the org get user permissions not found response
func (o *OrgGetUserPermissionsNotFound) Code() int {
	return 404
}

func (o *OrgGetUserPermissionsNotFound) Error() string {
	return fmt.Sprintf("[GET /users/{username}/orgs/{org}/permissions][%d] orgGetUserPermissionsNotFound", 404)
}

func (o *OrgGetUserPermissionsNotFound) String() string {
	return fmt.Sprintf("[GET /users/{username}/orgs/{org}/permissions][%d] orgGetUserPermissionsNotFound", 404)
}

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

	return nil
}
