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

// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package users

import (
	"encoding/json"
	stderrors "errors"
	"fmt"
	"io"

	"code.tnxs.net/vernonkeenan/lib/api/sfgate/sfgate_models"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// PutUsersSessionsReader is a Reader for the PutUsersSessions structure.
type PutUsersSessionsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutUsersSessionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutUsersSessionsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutUsersSessionsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutUsersSessionsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutUsersSessionsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutUsersSessionsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutUsersSessionsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /users/sessions] putUsersSessions", response, response.Code())
	}
}

// NewPutUsersSessionsOK creates a PutUsersSessionsOK with default headers values
func NewPutUsersSessionsOK() *PutUsersSessionsOK {
	return &PutUsersSessionsOK{}
}

// PutUsersSessionsOK describes a response with status code 200, with default header values.
//
// Response with User objects
type PutUsersSessionsOK struct {
	Payload *sfgate_models.UserResponse
}

// IsSuccess returns true when this put users sessions o k response has a 2xx status code
func (o *PutUsersSessionsOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this put users sessions o k response has a 3xx status code
func (o *PutUsersSessionsOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put users sessions o k response has a 4xx status code
func (o *PutUsersSessionsOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this put users sessions o k response has a 5xx status code
func (o *PutUsersSessionsOK) IsServerError() bool {
	return false
}

// IsCode returns true when this put users sessions o k response a status code equal to that given
func (o *PutUsersSessionsOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the put users sessions o k response
func (o *PutUsersSessionsOK) Code() int {
	return 200
}

func (o *PutUsersSessionsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /users/sessions][%d] putUsersSessionsOK %s", 200, payload)
}

func (o *PutUsersSessionsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /users/sessions][%d] putUsersSessionsOK %s", 200, payload)
}

func (o *PutUsersSessionsOK) GetPayload() *sfgate_models.UserResponse {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.UserResponse)

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

	return nil
}

// NewPutUsersSessionsUnauthorized creates a PutUsersSessionsUnauthorized with default headers values
func NewPutUsersSessionsUnauthorized() *PutUsersSessionsUnauthorized {
	return &PutUsersSessionsUnauthorized{}
}

// PutUsersSessionsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
type PutUsersSessionsUnauthorized struct {
	Payload *sfgate_models.Error
}

// IsSuccess returns true when this put users sessions unauthorized response has a 2xx status code
func (o *PutUsersSessionsUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put users sessions unauthorized response has a 3xx status code
func (o *PutUsersSessionsUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put users sessions unauthorized response has a 4xx status code
func (o *PutUsersSessionsUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this put users sessions unauthorized response has a 5xx status code
func (o *PutUsersSessionsUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this put users sessions unauthorized response a status code equal to that given
func (o *PutUsersSessionsUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the put users sessions unauthorized response
func (o *PutUsersSessionsUnauthorized) Code() int {
	return 401
}

func (o *PutUsersSessionsUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /users/sessions][%d] putUsersSessionsUnauthorized %s", 401, payload)
}

func (o *PutUsersSessionsUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /users/sessions][%d] putUsersSessionsUnauthorized %s", 401, payload)
}

func (o *PutUsersSessionsUnauthorized) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPutUsersSessionsForbidden creates a PutUsersSessionsForbidden with default headers values
func NewPutUsersSessionsForbidden() *PutUsersSessionsForbidden {
	return &PutUsersSessionsForbidden{}
}

// PutUsersSessionsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type PutUsersSessionsForbidden struct {
	Payload *sfgate_models.Error
}

// IsSuccess returns true when this put users sessions forbidden response has a 2xx status code
func (o *PutUsersSessionsForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put users sessions forbidden response has a 3xx status code
func (o *PutUsersSessionsForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put users sessions forbidden response has a 4xx status code
func (o *PutUsersSessionsForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this put users sessions forbidden response has a 5xx status code
func (o *PutUsersSessionsForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this put users sessions forbidden response a status code equal to that given
func (o *PutUsersSessionsForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the put users sessions forbidden response
func (o *PutUsersSessionsForbidden) Code() int {
	return 403
}

func (o *PutUsersSessionsForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /users/sessions][%d] putUsersSessionsForbidden %s", 403, payload)
}

func (o *PutUsersSessionsForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /users/sessions][%d] putUsersSessionsForbidden %s", 403, payload)
}

func (o *PutUsersSessionsForbidden) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPutUsersSessionsNotFound creates a PutUsersSessionsNotFound with default headers values
func NewPutUsersSessionsNotFound() *PutUsersSessionsNotFound {
	return &PutUsersSessionsNotFound{}
}

// PutUsersSessionsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
type PutUsersSessionsNotFound struct {
	Payload *sfgate_models.Error
}

// IsSuccess returns true when this put users sessions not found response has a 2xx status code
func (o *PutUsersSessionsNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put users sessions not found response has a 3xx status code
func (o *PutUsersSessionsNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put users sessions not found response has a 4xx status code
func (o *PutUsersSessionsNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this put users sessions not found response has a 5xx status code
func (o *PutUsersSessionsNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this put users sessions not found response a status code equal to that given
func (o *PutUsersSessionsNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the put users sessions not found response
func (o *PutUsersSessionsNotFound) Code() int {
	return 404
}

func (o *PutUsersSessionsNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /users/sessions][%d] putUsersSessionsNotFound %s", 404, payload)
}

func (o *PutUsersSessionsNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /users/sessions][%d] putUsersSessionsNotFound %s", 404, payload)
}

func (o *PutUsersSessionsNotFound) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPutUsersSessionsUnprocessableEntity creates a PutUsersSessionsUnprocessableEntity with default headers values
func NewPutUsersSessionsUnprocessableEntity() *PutUsersSessionsUnprocessableEntity {
	return &PutUsersSessionsUnprocessableEntity{}
}

// PutUsersSessionsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type PutUsersSessionsUnprocessableEntity struct {
	Payload *sfgate_models.Error
}

// IsSuccess returns true when this put users sessions unprocessable entity response has a 2xx status code
func (o *PutUsersSessionsUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put users sessions unprocessable entity response has a 3xx status code
func (o *PutUsersSessionsUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put users sessions unprocessable entity response has a 4xx status code
func (o *PutUsersSessionsUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this put users sessions unprocessable entity response has a 5xx status code
func (o *PutUsersSessionsUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this put users sessions unprocessable entity response a status code equal to that given
func (o *PutUsersSessionsUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the put users sessions unprocessable entity response
func (o *PutUsersSessionsUnprocessableEntity) Code() int {
	return 422
}

func (o *PutUsersSessionsUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /users/sessions][%d] putUsersSessionsUnprocessableEntity %s", 422, payload)
}

func (o *PutUsersSessionsUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /users/sessions][%d] putUsersSessionsUnprocessableEntity %s", 422, payload)
}

func (o *PutUsersSessionsUnprocessableEntity) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPutUsersSessionsInternalServerError creates a PutUsersSessionsInternalServerError with default headers values
func NewPutUsersSessionsInternalServerError() *PutUsersSessionsInternalServerError {
	return &PutUsersSessionsInternalServerError{}
}

// PutUsersSessionsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type PutUsersSessionsInternalServerError struct {
	Payload *sfgate_models.Error
}

// IsSuccess returns true when this put users sessions internal server error response has a 2xx status code
func (o *PutUsersSessionsInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put users sessions internal server error response has a 3xx status code
func (o *PutUsersSessionsInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put users sessions internal server error response has a 4xx status code
func (o *PutUsersSessionsInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this put users sessions internal server error response has a 5xx status code
func (o *PutUsersSessionsInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this put users sessions internal server error response a status code equal to that given
func (o *PutUsersSessionsInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the put users sessions internal server error response
func (o *PutUsersSessionsInternalServerError) Code() int {
	return 500
}

func (o *PutUsersSessionsInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /users/sessions][%d] putUsersSessionsInternalServerError %s", 500, payload)
}

func (o *PutUsersSessionsInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /users/sessions][%d] putUsersSessionsInternalServerError %s", 500, payload)
}

func (o *PutUsersSessionsInternalServerError) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}
