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

package lists

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

	"git.coopcloud.tech/decentral1se/gtslib/models"
)

// ListAccountsReader is a Reader for the ListAccounts structure.
type ListAccountsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ListAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewListAccountsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewListAccountsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewListAccountsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewListAccountsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 406:
		result := NewListAccountsNotAcceptable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewListAccountsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /api/v1/lists/{id}/accounts] listAccounts", response, response.Code())
	}
}

// NewListAccountsOK creates a ListAccountsOK with default headers values
func NewListAccountsOK() *ListAccountsOK {
	return &ListAccountsOK{}
}

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

Array of accounts.
*/
type ListAccountsOK struct {

	/* Links to the next and previous queries.
	 */
	Link string

	Payload []*models.Account
}

// IsSuccess returns true when this list accounts o k response has a 2xx status code
func (o *ListAccountsOK) IsSuccess() bool {
	return true
}

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

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

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

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

// Code gets the status code for the list accounts o k response
func (o *ListAccountsOK) Code() int {
	return 200
}

func (o *ListAccountsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsOK %s", 200, payload)
}

func (o *ListAccountsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsOK %s", 200, payload)
}

func (o *ListAccountsOK) GetPayload() []*models.Account {
	return o.Payload
}

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

	// hydrates response header Link
	hdrLink := response.GetHeader("Link")

	if hdrLink != "" {
		o.Link = hdrLink
	}

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

	return nil
}

// NewListAccountsBadRequest creates a ListAccountsBadRequest with default headers values
func NewListAccountsBadRequest() *ListAccountsBadRequest {
	return &ListAccountsBadRequest{}
}

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

bad request
*/
type ListAccountsBadRequest struct {
}

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

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

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

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

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

// Code gets the status code for the list accounts bad request response
func (o *ListAccountsBadRequest) Code() int {
	return 400
}

func (o *ListAccountsBadRequest) Error() string {
	return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsBadRequest", 400)
}

func (o *ListAccountsBadRequest) String() string {
	return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsBadRequest", 400)
}

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

	return nil
}

// NewListAccountsUnauthorized creates a ListAccountsUnauthorized with default headers values
func NewListAccountsUnauthorized() *ListAccountsUnauthorized {
	return &ListAccountsUnauthorized{}
}

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

unauthorized
*/
type ListAccountsUnauthorized struct {
}

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

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

// IsClientError returns true when this list accounts unauthorized response has a 4xx status code
func (o *ListAccountsUnauthorized) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the list accounts unauthorized response
func (o *ListAccountsUnauthorized) Code() int {
	return 401
}

func (o *ListAccountsUnauthorized) Error() string {
	return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsUnauthorized", 401)
}

func (o *ListAccountsUnauthorized) String() string {
	return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsUnauthorized", 401)
}

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

	return nil
}

// NewListAccountsNotFound creates a ListAccountsNotFound with default headers values
func NewListAccountsNotFound() *ListAccountsNotFound {
	return &ListAccountsNotFound{}
}

/*
ListAccountsNotFound describes a response with status code 404, with default header values.

not found
*/
type ListAccountsNotFound struct {
}

// IsSuccess returns true when this list accounts not found response has a 2xx status code
func (o *ListAccountsNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this list accounts not found response has a 3xx status code
func (o *ListAccountsNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this list accounts not found response has a 4xx status code
func (o *ListAccountsNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this list accounts not found response has a 5xx status code
func (o *ListAccountsNotFound) IsServerError() bool {
	return false
}

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

// Code gets the status code for the list accounts not found response
func (o *ListAccountsNotFound) Code() int {
	return 404
}

func (o *ListAccountsNotFound) Error() string {
	return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsNotFound", 404)
}

func (o *ListAccountsNotFound) String() string {
	return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsNotFound", 404)
}

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

	return nil
}

// NewListAccountsNotAcceptable creates a ListAccountsNotAcceptable with default headers values
func NewListAccountsNotAcceptable() *ListAccountsNotAcceptable {
	return &ListAccountsNotAcceptable{}
}

/*
ListAccountsNotAcceptable describes a response with status code 406, with default header values.

not acceptable
*/
type ListAccountsNotAcceptable struct {
}

// IsSuccess returns true when this list accounts not acceptable response has a 2xx status code
func (o *ListAccountsNotAcceptable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this list accounts not acceptable response has a 3xx status code
func (o *ListAccountsNotAcceptable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this list accounts not acceptable response has a 4xx status code
func (o *ListAccountsNotAcceptable) IsClientError() bool {
	return true
}

// IsServerError returns true when this list accounts not acceptable response has a 5xx status code
func (o *ListAccountsNotAcceptable) IsServerError() bool {
	return false
}

// IsCode returns true when this list accounts not acceptable response a status code equal to that given
func (o *ListAccountsNotAcceptable) IsCode(code int) bool {
	return code == 406
}

// Code gets the status code for the list accounts not acceptable response
func (o *ListAccountsNotAcceptable) Code() int {
	return 406
}

func (o *ListAccountsNotAcceptable) Error() string {
	return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsNotAcceptable", 406)
}

func (o *ListAccountsNotAcceptable) String() string {
	return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsNotAcceptable", 406)
}

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

	return nil
}

// NewListAccountsInternalServerError creates a ListAccountsInternalServerError with default headers values
func NewListAccountsInternalServerError() *ListAccountsInternalServerError {
	return &ListAccountsInternalServerError{}
}

/*
ListAccountsInternalServerError describes a response with status code 500, with default header values.

internal server error
*/
type ListAccountsInternalServerError struct {
}

// IsSuccess returns true when this list accounts internal server error response has a 2xx status code
func (o *ListAccountsInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this list accounts internal server error response has a 3xx status code
func (o *ListAccountsInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this list accounts internal server error response has a 4xx status code
func (o *ListAccountsInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this list accounts internal server error response has a 5xx status code
func (o *ListAccountsInternalServerError) IsServerError() bool {
	return true
}

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

// Code gets the status code for the list accounts internal server error response
func (o *ListAccountsInternalServerError) Code() int {
	return 500
}

func (o *ListAccountsInternalServerError) Error() string {
	return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsInternalServerError", 500)
}

func (o *ListAccountsInternalServerError) String() string {
	return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsInternalServerError", 500)
}

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

	return nil
}
