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

package admin

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

// AdminCreateRepoReader is a Reader for the AdminCreateRepo structure.
type AdminCreateRepoReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *AdminCreateRepoReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewAdminCreateRepoCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewAdminCreateRepoBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewAdminCreateRepoForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewAdminCreateRepoNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewAdminCreateRepoConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewAdminCreateRepoUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /admin/users/{username}/repos] adminCreateRepo", response, response.Code())
	}
}

// NewAdminCreateRepoCreated creates a AdminCreateRepoCreated with default headers values
func NewAdminCreateRepoCreated() *AdminCreateRepoCreated {
	return &AdminCreateRepoCreated{}
}

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

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

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

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

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

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

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

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

func (o *AdminCreateRepoCreated) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoCreated %s", 201, payload)
}

func (o *AdminCreateRepoCreated) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoCreated %s", 201, payload)
}

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

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

// NewAdminCreateRepoBadRequest creates a AdminCreateRepoBadRequest with default headers values
func NewAdminCreateRepoBadRequest() *AdminCreateRepoBadRequest {
	return &AdminCreateRepoBadRequest{}
}

/*
AdminCreateRepoBadRequest describes a response with status code 400, with default header values.

APIError is error format response
*/
type AdminCreateRepoBadRequest struct {
	Message string
	URL     string
}

// IsSuccess returns true when this admin create repo bad request response has a 2xx status code
func (o *AdminCreateRepoBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this admin create repo bad request response has a 3xx status code
func (o *AdminCreateRepoBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this admin create repo bad request response has a 4xx status code
func (o *AdminCreateRepoBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this admin create repo bad request response has a 5xx status code
func (o *AdminCreateRepoBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this admin create repo bad request response a status code equal to that given
func (o *AdminCreateRepoBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the admin create repo bad request response
func (o *AdminCreateRepoBadRequest) Code() int {
	return 400
}

func (o *AdminCreateRepoBadRequest) Error() string {
	return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoBadRequest", 400)
}

func (o *AdminCreateRepoBadRequest) String() string {
	return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoBadRequest", 400)
}

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

// NewAdminCreateRepoForbidden creates a AdminCreateRepoForbidden with default headers values
func NewAdminCreateRepoForbidden() *AdminCreateRepoForbidden {
	return &AdminCreateRepoForbidden{}
}

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

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

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

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

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

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

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

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

func (o *AdminCreateRepoForbidden) Error() string {
	return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoForbidden", 403)
}

func (o *AdminCreateRepoForbidden) String() string {
	return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoForbidden", 403)
}

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

// NewAdminCreateRepoNotFound creates a AdminCreateRepoNotFound with default headers values
func NewAdminCreateRepoNotFound() *AdminCreateRepoNotFound {
	return &AdminCreateRepoNotFound{}
}

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

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

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

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

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

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

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

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

func (o *AdminCreateRepoNotFound) Error() string {
	return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoNotFound", 404)
}

func (o *AdminCreateRepoNotFound) String() string {
	return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoNotFound", 404)
}

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

	return nil
}

// NewAdminCreateRepoConflict creates a AdminCreateRepoConflict with default headers values
func NewAdminCreateRepoConflict() *AdminCreateRepoConflict {
	return &AdminCreateRepoConflict{}
}

/*
AdminCreateRepoConflict describes a response with status code 409, with default header values.

APIError is error format response
*/
type AdminCreateRepoConflict struct {
	Message string
	URL     string
}

// IsSuccess returns true when this admin create repo conflict response has a 2xx status code
func (o *AdminCreateRepoConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this admin create repo conflict response has a 3xx status code
func (o *AdminCreateRepoConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this admin create repo conflict response has a 4xx status code
func (o *AdminCreateRepoConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this admin create repo conflict response has a 5xx status code
func (o *AdminCreateRepoConflict) IsServerError() bool {
	return false
}

// IsCode returns true when this admin create repo conflict response a status code equal to that given
func (o *AdminCreateRepoConflict) IsCode(code int) bool {
	return code == 409
}

// Code gets the status code for the admin create repo conflict response
func (o *AdminCreateRepoConflict) Code() int {
	return 409
}

func (o *AdminCreateRepoConflict) Error() string {
	return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoConflict", 409)
}

func (o *AdminCreateRepoConflict) String() string {
	return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoConflict", 409)
}

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

// NewAdminCreateRepoUnprocessableEntity creates a AdminCreateRepoUnprocessableEntity with default headers values
func NewAdminCreateRepoUnprocessableEntity() *AdminCreateRepoUnprocessableEntity {
	return &AdminCreateRepoUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

func (o *AdminCreateRepoUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoUnprocessableEntity", 422)
}

func (o *AdminCreateRepoUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /admin/users/{username}/repos][%d] adminCreateRepoUnprocessableEntity", 422)
}

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