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

// OrgEditLabelReader is a Reader for the OrgEditLabel structure.
type OrgEditLabelReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *OrgEditLabelReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewOrgEditLabelOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 404:
		result := NewOrgEditLabelNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewOrgEditLabelUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PATCH /orgs/{org}/labels/{id}] orgEditLabel", response, response.Code())
	}
}

// NewOrgEditLabelOK creates a OrgEditLabelOK with default headers values
func NewOrgEditLabelOK() *OrgEditLabelOK {
	return &OrgEditLabelOK{}
}

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

Label
*/
type OrgEditLabelOK struct {
	Payload *models.Label
}

// IsSuccess returns true when this org edit label o k response has a 2xx status code
func (o *OrgEditLabelOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this org edit label o k response has a 3xx status code
func (o *OrgEditLabelOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this org edit label o k response has a 4xx status code
func (o *OrgEditLabelOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this org edit label o k response has a 5xx status code
func (o *OrgEditLabelOK) IsServerError() bool {
	return false
}

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

// Code gets the status code for the org edit label o k response
func (o *OrgEditLabelOK) Code() int {
	return 200
}

func (o *OrgEditLabelOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /orgs/{org}/labels/{id}][%d] orgEditLabelOK %s", 200, payload)
}

func (o *OrgEditLabelOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PATCH /orgs/{org}/labels/{id}][%d] orgEditLabelOK %s", 200, payload)
}

func (o *OrgEditLabelOK) GetPayload() *models.Label {
	return o.Payload
}

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

	o.Payload = new(models.Label)

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

	return nil
}

// NewOrgEditLabelNotFound creates a OrgEditLabelNotFound with default headers values
func NewOrgEditLabelNotFound() *OrgEditLabelNotFound {
	return &OrgEditLabelNotFound{}
}

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

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

// IsSuccess returns true when this org edit label not found response has a 2xx status code
func (o *OrgEditLabelNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this org edit label not found response has a 3xx status code
func (o *OrgEditLabelNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this org edit label not found response has a 4xx status code
func (o *OrgEditLabelNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this org edit label not found response has a 5xx status code
func (o *OrgEditLabelNotFound) IsServerError() bool {
	return false
}

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

// Code gets the status code for the org edit label not found response
func (o *OrgEditLabelNotFound) Code() int {
	return 404
}

func (o *OrgEditLabelNotFound) Error() string {
	return fmt.Sprintf("[PATCH /orgs/{org}/labels/{id}][%d] orgEditLabelNotFound", 404)
}

func (o *OrgEditLabelNotFound) String() string {
	return fmt.Sprintf("[PATCH /orgs/{org}/labels/{id}][%d] orgEditLabelNotFound", 404)
}

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

	return nil
}

// NewOrgEditLabelUnprocessableEntity creates a OrgEditLabelUnprocessableEntity with default headers values
func NewOrgEditLabelUnprocessableEntity() *OrgEditLabelUnprocessableEntity {
	return &OrgEditLabelUnprocessableEntity{}
}

/*
OrgEditLabelUnprocessableEntity describes a response with status code 422, with default header values.

APIValidationError is error format response related to input validation
*/
type OrgEditLabelUnprocessableEntity struct {
	Message string
	URL     string
}

// IsSuccess returns true when this org edit label unprocessable entity response has a 2xx status code
func (o *OrgEditLabelUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this org edit label unprocessable entity response has a 3xx status code
func (o *OrgEditLabelUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this org edit label unprocessable entity response has a 4xx status code
func (o *OrgEditLabelUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this org edit label unprocessable entity response has a 5xx status code
func (o *OrgEditLabelUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this org edit label unprocessable entity response a status code equal to that given
func (o *OrgEditLabelUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the org edit label unprocessable entity response
func (o *OrgEditLabelUnprocessableEntity) Code() int {
	return 422
}

func (o *OrgEditLabelUnprocessableEntity) Error() string {
	return fmt.Sprintf("[PATCH /orgs/{org}/labels/{id}][%d] orgEditLabelUnprocessableEntity", 422)
}

func (o *OrgEditLabelUnprocessableEntity) String() string {
	return fmt.Sprintf("[PATCH /orgs/{org}/labels/{id}][%d] orgEditLabelUnprocessableEntity", 422)
}

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