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

// PostCarConfigVinReader is a Reader for the PostCarConfigVin structure.
type PostCarConfigVinReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCarConfigVinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostCarConfigVinOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostCarConfigVinBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostCarConfigVinUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostCarConfigVinServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /car_config/{vin}] PostCarConfigVin", response, response.Code())
	}
}

// NewPostCarConfigVinOK creates a PostCarConfigVinOK with default headers values
func NewPostCarConfigVinOK() *PostCarConfigVinOK {
	return &PostCarConfigVinOK{}
}

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

OK
*/
type PostCarConfigVinOK struct {
	Payload *models.CommonJSONMessage
}

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

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

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

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

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

// Code gets the status code for the post car config vin o k response
func (o *PostCarConfigVinOK) Code() int {
	return 200
}

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

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

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

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

// NewPostCarConfigVinBadRequest creates a PostCarConfigVinBadRequest with default headers values
func NewPostCarConfigVinBadRequest() *PostCarConfigVinBadRequest {
	return &PostCarConfigVinBadRequest{}
}

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

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

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

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

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

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

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

// Code gets the status code for the post car config vin bad request response
func (o *PostCarConfigVinBadRequest) Code() int {
	return 400
}

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

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

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

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

// NewPostCarConfigVinUnauthorized creates a PostCarConfigVinUnauthorized with default headers values
func NewPostCarConfigVinUnauthorized() *PostCarConfigVinUnauthorized {
	return &PostCarConfigVinUnauthorized{}
}

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

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

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

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

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

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

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

// Code gets the status code for the post car config vin unauthorized response
func (o *PostCarConfigVinUnauthorized) Code() int {
	return 401
}

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

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

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

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

// NewPostCarConfigVinServiceUnavailable creates a PostCarConfigVinServiceUnavailable with default headers values
func NewPostCarConfigVinServiceUnavailable() *PostCarConfigVinServiceUnavailable {
	return &PostCarConfigVinServiceUnavailable{}
}

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

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

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

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

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

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

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

// Code gets the status code for the post car config vin service unavailable response
func (o *PostCarConfigVinServiceUnavailable) Code() int {
	return 503
}

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

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

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

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