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

// PostFleetNameVehiclesAddReader is a Reader for the PostFleetNameVehiclesAdd structure.
type PostFleetNameVehiclesAddReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostFleetNameVehiclesAddReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostFleetNameVehiclesAddOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostFleetNameVehiclesAddBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostFleetNameVehiclesAddUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostFleetNameVehiclesAddServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /fleet/{name}/vehicles/add] PostFleetNameVehiclesAdd", response, response.Code())
	}
}

// NewPostFleetNameVehiclesAddOK creates a PostFleetNameVehiclesAddOK with default headers values
func NewPostFleetNameVehiclesAddOK() *PostFleetNameVehiclesAddOK {
	return &PostFleetNameVehiclesAddOK{}
}

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

OK
*/
type PostFleetNameVehiclesAddOK struct {
	Payload *models.CommonSubscriptionConfiguration
}

// IsSuccess returns true when this post fleet name vehicles add o k response has a 2xx status code
func (o *PostFleetNameVehiclesAddOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this post fleet name vehicles add o k response has a 3xx status code
func (o *PostFleetNameVehiclesAddOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post fleet name vehicles add o k response has a 4xx status code
func (o *PostFleetNameVehiclesAddOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this post fleet name vehicles add o k response has a 5xx status code
func (o *PostFleetNameVehiclesAddOK) IsServerError() bool {
	return false
}

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

// Code gets the status code for the post fleet name vehicles add o k response
func (o *PostFleetNameVehiclesAddOK) Code() int {
	return 200
}

func (o *PostFleetNameVehiclesAddOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet/{name}/vehicles/add][%d] postFleetNameVehiclesAddOK %s", 200, payload)
}

func (o *PostFleetNameVehiclesAddOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet/{name}/vehicles/add][%d] postFleetNameVehiclesAddOK %s", 200, payload)
}

func (o *PostFleetNameVehiclesAddOK) GetPayload() *models.CommonSubscriptionConfiguration {
	return o.Payload
}

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

	o.Payload = new(models.CommonSubscriptionConfiguration)

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

	return nil
}

// NewPostFleetNameVehiclesAddBadRequest creates a PostFleetNameVehiclesAddBadRequest with default headers values
func NewPostFleetNameVehiclesAddBadRequest() *PostFleetNameVehiclesAddBadRequest {
	return &PostFleetNameVehiclesAddBadRequest{}
}

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

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

// IsSuccess returns true when this post fleet name vehicles add bad request response has a 2xx status code
func (o *PostFleetNameVehiclesAddBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post fleet name vehicles add bad request response has a 3xx status code
func (o *PostFleetNameVehiclesAddBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post fleet name vehicles add bad request response has a 4xx status code
func (o *PostFleetNameVehiclesAddBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this post fleet name vehicles add bad request response has a 5xx status code
func (o *PostFleetNameVehiclesAddBadRequest) IsServerError() bool {
	return false
}

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

// Code gets the status code for the post fleet name vehicles add bad request response
func (o *PostFleetNameVehiclesAddBadRequest) Code() int {
	return 400
}

func (o *PostFleetNameVehiclesAddBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet/{name}/vehicles/add][%d] postFleetNameVehiclesAddBadRequest %s", 400, payload)
}

func (o *PostFleetNameVehiclesAddBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet/{name}/vehicles/add][%d] postFleetNameVehiclesAddBadRequest %s", 400, payload)
}

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

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

// NewPostFleetNameVehiclesAddUnauthorized creates a PostFleetNameVehiclesAddUnauthorized with default headers values
func NewPostFleetNameVehiclesAddUnauthorized() *PostFleetNameVehiclesAddUnauthorized {
	return &PostFleetNameVehiclesAddUnauthorized{}
}

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

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

// IsSuccess returns true when this post fleet name vehicles add unauthorized response has a 2xx status code
func (o *PostFleetNameVehiclesAddUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post fleet name vehicles add unauthorized response has a 3xx status code
func (o *PostFleetNameVehiclesAddUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post fleet name vehicles add unauthorized response has a 4xx status code
func (o *PostFleetNameVehiclesAddUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this post fleet name vehicles add unauthorized response has a 5xx status code
func (o *PostFleetNameVehiclesAddUnauthorized) IsServerError() bool {
	return false
}

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

// Code gets the status code for the post fleet name vehicles add unauthorized response
func (o *PostFleetNameVehiclesAddUnauthorized) Code() int {
	return 401
}

func (o *PostFleetNameVehiclesAddUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet/{name}/vehicles/add][%d] postFleetNameVehiclesAddUnauthorized %s", 401, payload)
}

func (o *PostFleetNameVehiclesAddUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet/{name}/vehicles/add][%d] postFleetNameVehiclesAddUnauthorized %s", 401, payload)
}

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

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

// NewPostFleetNameVehiclesAddServiceUnavailable creates a PostFleetNameVehiclesAddServiceUnavailable with default headers values
func NewPostFleetNameVehiclesAddServiceUnavailable() *PostFleetNameVehiclesAddServiceUnavailable {
	return &PostFleetNameVehiclesAddServiceUnavailable{}
}

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

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

// IsSuccess returns true when this post fleet name vehicles add service unavailable response has a 2xx status code
func (o *PostFleetNameVehiclesAddServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post fleet name vehicles add service unavailable response has a 3xx status code
func (o *PostFleetNameVehiclesAddServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post fleet name vehicles add service unavailable response has a 4xx status code
func (o *PostFleetNameVehiclesAddServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this post fleet name vehicles add service unavailable response has a 5xx status code
func (o *PostFleetNameVehiclesAddServiceUnavailable) IsServerError() bool {
	return true
}

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

// Code gets the status code for the post fleet name vehicles add service unavailable response
func (o *PostFleetNameVehiclesAddServiceUnavailable) Code() int {
	return 503
}

func (o *PostFleetNameVehiclesAddServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet/{name}/vehicles/add][%d] postFleetNameVehiclesAddServiceUnavailable %s", 503, payload)
}

func (o *PostFleetNameVehiclesAddServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet/{name}/vehicles/add][%d] postFleetNameVehiclesAddServiceUnavailable %s", 503, payload)
}

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

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