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

// CreateOrgRepoDeprecatedReader is a Reader for the CreateOrgRepoDeprecated structure.
type CreateOrgRepoDeprecatedReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *CreateOrgRepoDeprecatedReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewCreateOrgRepoDeprecatedCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewCreateOrgRepoDeprecatedForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewCreateOrgRepoDeprecatedNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewCreateOrgRepoDeprecatedUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /org/{org}/repos] createOrgRepoDeprecated", response, response.Code())
	}
}

// NewCreateOrgRepoDeprecatedCreated creates a CreateOrgRepoDeprecatedCreated with default headers values
func NewCreateOrgRepoDeprecatedCreated() *CreateOrgRepoDeprecatedCreated {
	return &CreateOrgRepoDeprecatedCreated{}
}

/*
CreateOrgRepoDeprecatedCreated describes a response with status code 201, with default header values.

Repository
*/
type CreateOrgRepoDeprecatedCreated struct {
	Payload *models.Repository
}

// IsSuccess returns true when this create org repo deprecated created response has a 2xx status code
func (o *CreateOrgRepoDeprecatedCreated) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this create org repo deprecated created response has a 3xx status code
func (o *CreateOrgRepoDeprecatedCreated) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create org repo deprecated created response has a 4xx status code
func (o *CreateOrgRepoDeprecatedCreated) IsClientError() bool {
	return false
}

// IsServerError returns true when this create org repo deprecated created response has a 5xx status code
func (o *CreateOrgRepoDeprecatedCreated) IsServerError() bool {
	return false
}

// IsCode returns true when this create org repo deprecated created response a status code equal to that given
func (o *CreateOrgRepoDeprecatedCreated) IsCode(code int) bool {
	return code == 201
}

// Code gets the status code for the create org repo deprecated created response
func (o *CreateOrgRepoDeprecatedCreated) Code() int {
	return 201
}

func (o *CreateOrgRepoDeprecatedCreated) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /org/{org}/repos][%d] createOrgRepoDeprecatedCreated %s", 201, payload)
}

func (o *CreateOrgRepoDeprecatedCreated) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /org/{org}/repos][%d] createOrgRepoDeprecatedCreated %s", 201, payload)
}

func (o *CreateOrgRepoDeprecatedCreated) GetPayload() *models.Repository {
	return o.Payload
}

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

	o.Payload = new(models.Repository)

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

	return nil
}

// NewCreateOrgRepoDeprecatedForbidden creates a CreateOrgRepoDeprecatedForbidden with default headers values
func NewCreateOrgRepoDeprecatedForbidden() *CreateOrgRepoDeprecatedForbidden {
	return &CreateOrgRepoDeprecatedForbidden{}
}

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

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

// IsSuccess returns true when this create org repo deprecated forbidden response has a 2xx status code
func (o *CreateOrgRepoDeprecatedForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this create org repo deprecated forbidden response has a 3xx status code
func (o *CreateOrgRepoDeprecatedForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create org repo deprecated forbidden response has a 4xx status code
func (o *CreateOrgRepoDeprecatedForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this create org repo deprecated forbidden response has a 5xx status code
func (o *CreateOrgRepoDeprecatedForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this create org repo deprecated forbidden response a status code equal to that given
func (o *CreateOrgRepoDeprecatedForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the create org repo deprecated forbidden response
func (o *CreateOrgRepoDeprecatedForbidden) Code() int {
	return 403
}

func (o *CreateOrgRepoDeprecatedForbidden) Error() string {
	return fmt.Sprintf("[POST /org/{org}/repos][%d] createOrgRepoDeprecatedForbidden", 403)
}

func (o *CreateOrgRepoDeprecatedForbidden) String() string {
	return fmt.Sprintf("[POST /org/{org}/repos][%d] createOrgRepoDeprecatedForbidden", 403)
}

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

// NewCreateOrgRepoDeprecatedNotFound creates a CreateOrgRepoDeprecatedNotFound with default headers values
func NewCreateOrgRepoDeprecatedNotFound() *CreateOrgRepoDeprecatedNotFound {
	return &CreateOrgRepoDeprecatedNotFound{}
}

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

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

// IsSuccess returns true when this create org repo deprecated not found response has a 2xx status code
func (o *CreateOrgRepoDeprecatedNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this create org repo deprecated not found response has a 3xx status code
func (o *CreateOrgRepoDeprecatedNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create org repo deprecated not found response has a 4xx status code
func (o *CreateOrgRepoDeprecatedNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this create org repo deprecated not found response has a 5xx status code
func (o *CreateOrgRepoDeprecatedNotFound) IsServerError() bool {
	return false
}

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

// Code gets the status code for the create org repo deprecated not found response
func (o *CreateOrgRepoDeprecatedNotFound) Code() int {
	return 404
}

func (o *CreateOrgRepoDeprecatedNotFound) Error() string {
	return fmt.Sprintf("[POST /org/{org}/repos][%d] createOrgRepoDeprecatedNotFound", 404)
}

func (o *CreateOrgRepoDeprecatedNotFound) String() string {
	return fmt.Sprintf("[POST /org/{org}/repos][%d] createOrgRepoDeprecatedNotFound", 404)
}

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

	return nil
}

// NewCreateOrgRepoDeprecatedUnprocessableEntity creates a CreateOrgRepoDeprecatedUnprocessableEntity with default headers values
func NewCreateOrgRepoDeprecatedUnprocessableEntity() *CreateOrgRepoDeprecatedUnprocessableEntity {
	return &CreateOrgRepoDeprecatedUnprocessableEntity{}
}

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

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

// IsSuccess returns true when this create org repo deprecated unprocessable entity response has a 2xx status code
func (o *CreateOrgRepoDeprecatedUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this create org repo deprecated unprocessable entity response has a 3xx status code
func (o *CreateOrgRepoDeprecatedUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create org repo deprecated unprocessable entity response has a 4xx status code
func (o *CreateOrgRepoDeprecatedUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this create org repo deprecated unprocessable entity response has a 5xx status code
func (o *CreateOrgRepoDeprecatedUnprocessableEntity) IsServerError() bool {
	return false
}

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

// Code gets the status code for the create org repo deprecated unprocessable entity response
func (o *CreateOrgRepoDeprecatedUnprocessableEntity) Code() int {
	return 422
}

func (o *CreateOrgRepoDeprecatedUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /org/{org}/repos][%d] createOrgRepoDeprecatedUnprocessableEntity", 422)
}

func (o *CreateOrgRepoDeprecatedUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /org/{org}/repos][%d] createOrgRepoDeprecatedUnprocessableEntity", 422)
}

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