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

package admin

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"
	"fmt"
	"io"
	"strconv"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
)

// ListOrganizationMembersReader is a Reader for the ListOrganizationMembers structure.
type ListOrganizationMembersReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ListOrganizationMembersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewListOrganizationMembersOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewListOrganizationMembersUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewListOrganizationMembersNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewListOrganizationMembersInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /organization/list] listOrganizationMembers", response, response.Code())
	}
}

// NewListOrganizationMembersOK creates a ListOrganizationMembersOK with default headers values
func NewListOrganizationMembersOK() *ListOrganizationMembersOK {
	return &ListOrganizationMembersOK{}
}

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

list organization members
*/
type ListOrganizationMembersOK struct {
	Payload *ListOrganizationMembersOKBody
}

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

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

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

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

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

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

func (o *ListOrganizationMembersOK) Error() string {
	return fmt.Sprintf("[POST /organization/list][%d] listOrganizationMembersOK  %+v", 200, o.Payload)
}

func (o *ListOrganizationMembersOK) String() string {
	return fmt.Sprintf("[POST /organization/list][%d] listOrganizationMembersOK  %+v", 200, o.Payload)
}

func (o *ListOrganizationMembersOK) GetPayload() *ListOrganizationMembersOKBody {
	return o.Payload
}

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

	o.Payload = new(ListOrganizationMembersOKBody)

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

	return nil
}

// NewListOrganizationMembersUnauthorized creates a ListOrganizationMembersUnauthorized with default headers values
func NewListOrganizationMembersUnauthorized() *ListOrganizationMembersUnauthorized {
	return &ListOrganizationMembersUnauthorized{}
}

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

unauthorized
*/
type ListOrganizationMembersUnauthorized struct {
}

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

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

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

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

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

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

func (o *ListOrganizationMembersUnauthorized) Error() string {
	return fmt.Sprintf("[POST /organization/list][%d] listOrganizationMembersUnauthorized ", 401)
}

func (o *ListOrganizationMembersUnauthorized) String() string {
	return fmt.Sprintf("[POST /organization/list][%d] listOrganizationMembersUnauthorized ", 401)
}

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

	return nil
}

// NewListOrganizationMembersNotFound creates a ListOrganizationMembersNotFound with default headers values
func NewListOrganizationMembersNotFound() *ListOrganizationMembersNotFound {
	return &ListOrganizationMembersNotFound{}
}

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

not found
*/
type ListOrganizationMembersNotFound struct {
}

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

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

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

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

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

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

func (o *ListOrganizationMembersNotFound) Error() string {
	return fmt.Sprintf("[POST /organization/list][%d] listOrganizationMembersNotFound ", 404)
}

func (o *ListOrganizationMembersNotFound) String() string {
	return fmt.Sprintf("[POST /organization/list][%d] listOrganizationMembersNotFound ", 404)
}

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

	return nil
}

// NewListOrganizationMembersInternalServerError creates a ListOrganizationMembersInternalServerError with default headers values
func NewListOrganizationMembersInternalServerError() *ListOrganizationMembersInternalServerError {
	return &ListOrganizationMembersInternalServerError{}
}

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

internal server error
*/
type ListOrganizationMembersInternalServerError struct {
}

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

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

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

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

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

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

func (o *ListOrganizationMembersInternalServerError) Error() string {
	return fmt.Sprintf("[POST /organization/list][%d] listOrganizationMembersInternalServerError ", 500)
}

func (o *ListOrganizationMembersInternalServerError) String() string {
	return fmt.Sprintf("[POST /organization/list][%d] listOrganizationMembersInternalServerError ", 500)
}

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

	return nil
}

/*
ListOrganizationMembersBody list organization members body
swagger:model ListOrganizationMembersBody
*/
type ListOrganizationMembersBody struct {

	// token
	Token string `json:"token,omitempty"`
}

// Validate validates this list organization members body
func (o *ListOrganizationMembersBody) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this list organization members body based on context it is used
func (o *ListOrganizationMembersBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *ListOrganizationMembersBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *ListOrganizationMembersBody) UnmarshalBinary(b []byte) error {
	var res ListOrganizationMembersBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
ListOrganizationMembersOKBody list organization members o k body
swagger:model ListOrganizationMembersOKBody
*/
type ListOrganizationMembersOKBody struct {

	// members
	Members []*ListOrganizationMembersOKBodyMembersItems0 `json:"members"`
}

// Validate validates this list organization members o k body
func (o *ListOrganizationMembersOKBody) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateMembers(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *ListOrganizationMembersOKBody) validateMembers(formats strfmt.Registry) error {
	if swag.IsZero(o.Members) { // not required
		return nil
	}

	for i := 0; i < len(o.Members); i++ {
		if swag.IsZero(o.Members[i]) { // not required
			continue
		}

		if o.Members[i] != nil {
			if err := o.Members[i].Validate(formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("listOrganizationMembersOK" + "." + "members" + "." + strconv.Itoa(i))
				} else if ce, ok := err.(*errors.CompositeError); ok {
					return ce.ValidateName("listOrganizationMembersOK" + "." + "members" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

// ContextValidate validate this list organization members o k body based on the context it is used
func (o *ListOrganizationMembersOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

	if err := o.contextValidateMembers(ctx, formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *ListOrganizationMembersOKBody) contextValidateMembers(ctx context.Context, formats strfmt.Registry) error {

	for i := 0; i < len(o.Members); i++ {

		if o.Members[i] != nil {

			if swag.IsZero(o.Members[i]) { // not required
				return nil
			}

			if err := o.Members[i].ContextValidate(ctx, formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("listOrganizationMembersOK" + "." + "members" + "." + strconv.Itoa(i))
				} else if ce, ok := err.(*errors.CompositeError); ok {
					return ce.ValidateName("listOrganizationMembersOK" + "." + "members" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

// MarshalBinary interface implementation
func (o *ListOrganizationMembersOKBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *ListOrganizationMembersOKBody) UnmarshalBinary(b []byte) error {
	var res ListOrganizationMembersOKBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
ListOrganizationMembersOKBodyMembersItems0 list organization members o k body members items0
swagger:model ListOrganizationMembersOKBodyMembersItems0
*/
type ListOrganizationMembersOKBodyMembersItems0 struct {

	// admin
	Admin bool `json:"admin,omitempty"`

	// email
	Email string `json:"email,omitempty"`
}

// Validate validates this list organization members o k body members items0
func (o *ListOrganizationMembersOKBodyMembersItems0) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this list organization members o k body members items0 based on context it is used
func (o *ListOrganizationMembersOKBodyMembersItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *ListOrganizationMembersOKBodyMembersItems0) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *ListOrganizationMembersOKBodyMembersItems0) UnmarshalBinary(b []byte) error {
	var res ListOrganizationMembersOKBodyMembersItems0
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}
