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

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

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

// DeleteSessionReader is a Reader for the DeleteSession structure.
type DeleteSessionReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *DeleteSessionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 204:
		result := NewDeleteSessionNoContent()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewDeleteSessionUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[DELETE /sessions/current] deleteSession", response, response.Code())
	}
}

// NewDeleteSessionNoContent creates a DeleteSessionNoContent with default headers values
func NewDeleteSessionNoContent() *DeleteSessionNoContent {
	return &DeleteSessionNoContent{}
}

// DeleteSessionNoContent describes a response with status code 204, with default header values.
//
// Logged out; kvSession cookie cleared
type DeleteSessionNoContent struct {

	// kvSession=; HttpOnly; Secure; SameSite=None; Domain=.keenanvision.net; Path=/; Max-Age=0
	SetCookie string
}

// IsSuccess returns true when this delete session no content response has a 2xx status code
func (o *DeleteSessionNoContent) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this delete session no content response has a 3xx status code
func (o *DeleteSessionNoContent) IsRedirect() bool {
	return false
}

// IsClientError returns true when this delete session no content response has a 4xx status code
func (o *DeleteSessionNoContent) IsClientError() bool {
	return false
}

// IsServerError returns true when this delete session no content response has a 5xx status code
func (o *DeleteSessionNoContent) IsServerError() bool {
	return false
}

// IsCode returns true when this delete session no content response a status code equal to that given
func (o *DeleteSessionNoContent) IsCode(code int) bool {
	return code == 204
}

// Code gets the status code for the delete session no content response
func (o *DeleteSessionNoContent) Code() int {
	return 204
}

func (o *DeleteSessionNoContent) Error() string {
	return fmt.Sprintf("[DELETE /sessions/current][%d] deleteSessionNoContent", 204)
}

func (o *DeleteSessionNoContent) String() string {
	return fmt.Sprintf("[DELETE /sessions/current][%d] deleteSessionNoContent", 204)
}

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

	// hydrates response header Set-Cookie
	hdrSetCookie := response.GetHeader("Set-Cookie")

	if hdrSetCookie != "" {
		o.SetCookie = hdrSetCookie
	}

	return nil
}

// NewDeleteSessionUnauthorized creates a DeleteSessionUnauthorized with default headers values
func NewDeleteSessionUnauthorized() *DeleteSessionUnauthorized {
	return &DeleteSessionUnauthorized{}
}

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

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

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

// IsClientError returns true when this delete session unauthorized response has a 4xx status code
func (o *DeleteSessionUnauthorized) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the delete session unauthorized response
func (o *DeleteSessionUnauthorized) Code() int {
	return 401
}

func (o *DeleteSessionUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /sessions/current][%d] deleteSessionUnauthorized %s", 401, payload)
}

func (o *DeleteSessionUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[DELETE /sessions/current][%d] deleteSessionUnauthorized %s", 401, payload)
}

func (o *DeleteSessionUnauthorized) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}
