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

// PostSmsReader is a Reader for the PostSms structure.
type PostSmsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostSmsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostSmsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostSmsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostSmsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 408:
		result := NewPostSmsRequestTimeout()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostSmsServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /sms] PostSms", response, response.Code())
	}
}

// NewPostSmsOK creates a PostSmsOK with default headers values
func NewPostSmsOK() *PostSmsOK {
	return &PostSmsOK{}
}

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

OK
*/
type PostSmsOK struct {
	Payload *models.SmsSMSDetailsResponse
}

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

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

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

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

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

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

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

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

func (o *PostSmsOK) GetPayload() *models.SmsSMSDetailsResponse {
	return o.Payload
}

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

	o.Payload = new(models.SmsSMSDetailsResponse)

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

	return nil
}

// NewPostSmsBadRequest creates a PostSmsBadRequest with default headers values
func NewPostSmsBadRequest() *PostSmsBadRequest {
	return &PostSmsBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostSmsUnauthorized creates a PostSmsUnauthorized with default headers values
func NewPostSmsUnauthorized() *PostSmsUnauthorized {
	return &PostSmsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostSmsRequestTimeout creates a PostSmsRequestTimeout with default headers values
func NewPostSmsRequestTimeout() *PostSmsRequestTimeout {
	return &PostSmsRequestTimeout{}
}

/*
PostSmsRequestTimeout describes a response with status code 408, with default header values.

Request timeout
*/
type PostSmsRequestTimeout struct {
	Payload *models.CommonJSONError
}

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

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

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

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

// IsCode returns true when this post sms request timeout response a status code equal to that given
func (o *PostSmsRequestTimeout) IsCode(code int) bool {
	return code == 408
}

// Code gets the status code for the post sms request timeout response
func (o *PostSmsRequestTimeout) Code() int {
	return 408
}

func (o *PostSmsRequestTimeout) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /sms][%d] postSmsRequestTimeout %s", 408, payload)
}

func (o *PostSmsRequestTimeout) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /sms][%d] postSmsRequestTimeout %s", 408, payload)
}

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

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

// NewPostSmsServiceUnavailable creates a PostSmsServiceUnavailable with default headers values
func NewPostSmsServiceUnavailable() *PostSmsServiceUnavailable {
	return &PostSmsServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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