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

package user

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

// UserVerifyGPGKeyReader is a Reader for the UserVerifyGPGKey structure.
type UserVerifyGPGKeyReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UserVerifyGPGKeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewUserVerifyGPGKeyCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 404:
		result := NewUserVerifyGPGKeyNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewUserVerifyGPGKeyUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /user/gpg_key_verify] userVerifyGPGKey", response, response.Code())
	}
}

// NewUserVerifyGPGKeyCreated creates a UserVerifyGPGKeyCreated with default headers values
func NewUserVerifyGPGKeyCreated() *UserVerifyGPGKeyCreated {
	return &UserVerifyGPGKeyCreated{}
}

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

GPGKey
*/
type UserVerifyGPGKeyCreated struct {
	Payload *models.GPGKey
}

// IsSuccess returns true when this user verify g p g key created response has a 2xx status code
func (o *UserVerifyGPGKeyCreated) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this user verify g p g key created response has a 3xx status code
func (o *UserVerifyGPGKeyCreated) IsRedirect() bool {
	return false
}

// IsClientError returns true when this user verify g p g key created response has a 4xx status code
func (o *UserVerifyGPGKeyCreated) IsClientError() bool {
	return false
}

// IsServerError returns true when this user verify g p g key created response has a 5xx status code
func (o *UserVerifyGPGKeyCreated) IsServerError() bool {
	return false
}

// IsCode returns true when this user verify g p g key created response a status code equal to that given
func (o *UserVerifyGPGKeyCreated) IsCode(code int) bool {
	return code == 201
}

// Code gets the status code for the user verify g p g key created response
func (o *UserVerifyGPGKeyCreated) Code() int {
	return 201
}

func (o *UserVerifyGPGKeyCreated) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /user/gpg_key_verify][%d] userVerifyGPGKeyCreated %s", 201, payload)
}

func (o *UserVerifyGPGKeyCreated) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /user/gpg_key_verify][%d] userVerifyGPGKeyCreated %s", 201, payload)
}

func (o *UserVerifyGPGKeyCreated) GetPayload() *models.GPGKey {
	return o.Payload
}

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

	o.Payload = new(models.GPGKey)

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

	return nil
}

// NewUserVerifyGPGKeyNotFound creates a UserVerifyGPGKeyNotFound with default headers values
func NewUserVerifyGPGKeyNotFound() *UserVerifyGPGKeyNotFound {
	return &UserVerifyGPGKeyNotFound{}
}

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

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

// IsSuccess returns true when this user verify g p g key not found response has a 2xx status code
func (o *UserVerifyGPGKeyNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this user verify g p g key not found response has a 3xx status code
func (o *UserVerifyGPGKeyNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this user verify g p g key not found response has a 4xx status code
func (o *UserVerifyGPGKeyNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this user verify g p g key not found response has a 5xx status code
func (o *UserVerifyGPGKeyNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this user verify g p g key not found response a status code equal to that given
func (o *UserVerifyGPGKeyNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the user verify g p g key not found response
func (o *UserVerifyGPGKeyNotFound) Code() int {
	return 404
}

func (o *UserVerifyGPGKeyNotFound) Error() string {
	return fmt.Sprintf("[POST /user/gpg_key_verify][%d] userVerifyGPGKeyNotFound", 404)
}

func (o *UserVerifyGPGKeyNotFound) String() string {
	return fmt.Sprintf("[POST /user/gpg_key_verify][%d] userVerifyGPGKeyNotFound", 404)
}

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

	return nil
}

// NewUserVerifyGPGKeyUnprocessableEntity creates a UserVerifyGPGKeyUnprocessableEntity with default headers values
func NewUserVerifyGPGKeyUnprocessableEntity() *UserVerifyGPGKeyUnprocessableEntity {
	return &UserVerifyGPGKeyUnprocessableEntity{}
}

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

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

// IsSuccess returns true when this user verify g p g key unprocessable entity response has a 2xx status code
func (o *UserVerifyGPGKeyUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this user verify g p g key unprocessable entity response has a 3xx status code
func (o *UserVerifyGPGKeyUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this user verify g p g key unprocessable entity response has a 4xx status code
func (o *UserVerifyGPGKeyUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this user verify g p g key unprocessable entity response has a 5xx status code
func (o *UserVerifyGPGKeyUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this user verify g p g key unprocessable entity response a status code equal to that given
func (o *UserVerifyGPGKeyUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the user verify g p g key unprocessable entity response
func (o *UserVerifyGPGKeyUnprocessableEntity) Code() int {
	return 422
}

func (o *UserVerifyGPGKeyUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /user/gpg_key_verify][%d] userVerifyGPGKeyUnprocessableEntity", 422)
}

func (o *UserVerifyGPGKeyUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /user/gpg_key_verify][%d] userVerifyGPGKeyUnprocessableEntity", 422)
}

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