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

package operations

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

	"github.com/fiskerinc/cloud-services/pkg/ota_api/models"
)

// PostTagsReader is a Reader for the PostTags structure.
type PostTagsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostTagsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostTagsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostTagsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostTagsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostTagsServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /tags] PostTags", response, response.Code())
	}
}

// NewPostTagsOK creates a PostTagsOK with default headers values
func NewPostTagsOK() *PostTagsOK {
	return &PostTagsOK{}
}

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

Updated tags
*/
type PostTagsOK struct {
	Payload *models.CommonJSONMessage
}

// IsSuccess returns true when this post tags o k response has a 2xx status code
func (o *PostTagsOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this post tags o k response has a 3xx status code
func (o *PostTagsOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post tags o k response has a 4xx status code
func (o *PostTagsOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this post tags o k response has a 5xx status code
func (o *PostTagsOK) IsServerError() bool {
	return false
}

// IsCode returns true when this post tags o k response a status code equal to that given
func (o *PostTagsOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the post tags o k response
func (o *PostTagsOK) Code() int {
	return 200
}

func (o *PostTagsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /tags][%d] postTagsOK %s", 200, payload)
}

func (o *PostTagsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /tags][%d] postTagsOK %s", 200, payload)
}

func (o *PostTagsOK) GetPayload() *models.CommonJSONMessage {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONMessage)

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

	return nil
}

// NewPostTagsBadRequest creates a PostTagsBadRequest with default headers values
func NewPostTagsBadRequest() *PostTagsBadRequest {
	return &PostTagsBadRequest{}
}

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

Bad request
*/
type PostTagsBadRequest struct {
	Payload *models.CommonJSONError
}

// IsSuccess returns true when this post tags bad request response has a 2xx status code
func (o *PostTagsBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post tags bad request response has a 3xx status code
func (o *PostTagsBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post tags bad request response has a 4xx status code
func (o *PostTagsBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this post tags bad request response has a 5xx status code
func (o *PostTagsBadRequest) IsServerError() bool {
	return false
}

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

// Code gets the status code for the post tags bad request response
func (o *PostTagsBadRequest) Code() int {
	return 400
}

func (o *PostTagsBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /tags][%d] postTagsBadRequest %s", 400, payload)
}

func (o *PostTagsBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /tags][%d] postTagsBadRequest %s", 400, payload)
}

func (o *PostTagsBadRequest) GetPayload() *models.CommonJSONError {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONError)

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

	return nil
}

// NewPostTagsUnauthorized creates a PostTagsUnauthorized with default headers values
func NewPostTagsUnauthorized() *PostTagsUnauthorized {
	return &PostTagsUnauthorized{}
}

/*
PostTagsUnauthorized describes a response with status code 401, with default header values.

Unauthorized
*/
type PostTagsUnauthorized struct {
	Payload *models.CommonJSONError
}

// IsSuccess returns true when this post tags unauthorized response has a 2xx status code
func (o *PostTagsUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post tags unauthorized response has a 3xx status code
func (o *PostTagsUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post tags unauthorized response has a 4xx status code
func (o *PostTagsUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this post tags unauthorized response has a 5xx status code
func (o *PostTagsUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this post tags unauthorized response a status code equal to that given
func (o *PostTagsUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the post tags unauthorized response
func (o *PostTagsUnauthorized) Code() int {
	return 401
}

func (o *PostTagsUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /tags][%d] postTagsUnauthorized %s", 401, payload)
}

func (o *PostTagsUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /tags][%d] postTagsUnauthorized %s", 401, payload)
}

func (o *PostTagsUnauthorized) GetPayload() *models.CommonJSONError {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONError)

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

	return nil
}

// NewPostTagsServiceUnavailable creates a PostTagsServiceUnavailable with default headers values
func NewPostTagsServiceUnavailable() *PostTagsServiceUnavailable {
	return &PostTagsServiceUnavailable{}
}

/*
PostTagsServiceUnavailable describes a response with status code 503, with default header values.

Service unavailable
*/
type PostTagsServiceUnavailable struct {
	Payload *models.CommonJSONError
}

// IsSuccess returns true when this post tags service unavailable response has a 2xx status code
func (o *PostTagsServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post tags service unavailable response has a 3xx status code
func (o *PostTagsServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post tags service unavailable response has a 4xx status code
func (o *PostTagsServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this post tags service unavailable response has a 5xx status code
func (o *PostTagsServiceUnavailable) IsServerError() bool {
	return true
}

// IsCode returns true when this post tags service unavailable response a status code equal to that given
func (o *PostTagsServiceUnavailable) IsCode(code int) bool {
	return code == 503
}

// Code gets the status code for the post tags service unavailable response
func (o *PostTagsServiceUnavailable) Code() int {
	return 503
}

func (o *PostTagsServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /tags][%d] postTagsServiceUnavailable %s", 503, payload)
}

func (o *PostTagsServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /tags][%d] postTagsServiceUnavailable %s", 503, payload)
}

func (o *PostTagsServiceUnavailable) GetPayload() *models.CommonJSONError {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONError)

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

	return nil
}
