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

package account

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

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

	"github.com/openziti/zrok/rest_model_zrok"
)

// InviteReader is a Reader for the Invite structure.
type InviteReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *InviteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewInviteCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewInviteBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewInviteUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewInviteInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /invite] invite", response, response.Code())
	}
}

// NewInviteCreated creates a InviteCreated with default headers values
func NewInviteCreated() *InviteCreated {
	return &InviteCreated{}
}

/*
InviteCreated describes a response with status code 201, with default header values.

invitation created
*/
type InviteCreated struct {
}

// IsSuccess returns true when this invite created response has a 2xx status code
func (o *InviteCreated) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this invite created response has a 3xx status code
func (o *InviteCreated) IsRedirect() bool {
	return false
}

// IsClientError returns true when this invite created response has a 4xx status code
func (o *InviteCreated) IsClientError() bool {
	return false
}

// IsServerError returns true when this invite created response has a 5xx status code
func (o *InviteCreated) IsServerError() bool {
	return false
}

// IsCode returns true when this invite created response a status code equal to that given
func (o *InviteCreated) IsCode(code int) bool {
	return code == 201
}

// Code gets the status code for the invite created response
func (o *InviteCreated) Code() int {
	return 201
}

func (o *InviteCreated) Error() string {
	return fmt.Sprintf("[POST /invite][%d] inviteCreated ", 201)
}

func (o *InviteCreated) String() string {
	return fmt.Sprintf("[POST /invite][%d] inviteCreated ", 201)
}

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

	return nil
}

// NewInviteBadRequest creates a InviteBadRequest with default headers values
func NewInviteBadRequest() *InviteBadRequest {
	return &InviteBadRequest{}
}

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

invitation not created (already exists)
*/
type InviteBadRequest struct {
	Payload rest_model_zrok.ErrorMessage
}

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

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

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

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

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

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

func (o *InviteBadRequest) Error() string {
	return fmt.Sprintf("[POST /invite][%d] inviteBadRequest  %+v", 400, o.Payload)
}

func (o *InviteBadRequest) String() string {
	return fmt.Sprintf("[POST /invite][%d] inviteBadRequest  %+v", 400, o.Payload)
}

func (o *InviteBadRequest) GetPayload() rest_model_zrok.ErrorMessage {
	return o.Payload
}

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

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

	return nil
}

// NewInviteUnauthorized creates a InviteUnauthorized with default headers values
func NewInviteUnauthorized() *InviteUnauthorized {
	return &InviteUnauthorized{}
}

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

unauthorized
*/
type InviteUnauthorized struct {
}

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

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

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

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

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

// Code gets the status code for the invite unauthorized response
func (o *InviteUnauthorized) Code() int {
	return 401
}

func (o *InviteUnauthorized) Error() string {
	return fmt.Sprintf("[POST /invite][%d] inviteUnauthorized ", 401)
}

func (o *InviteUnauthorized) String() string {
	return fmt.Sprintf("[POST /invite][%d] inviteUnauthorized ", 401)
}

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

	return nil
}

// NewInviteInternalServerError creates a InviteInternalServerError with default headers values
func NewInviteInternalServerError() *InviteInternalServerError {
	return &InviteInternalServerError{}
}

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

internal server error
*/
type InviteInternalServerError struct {
}

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

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

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

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

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

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

func (o *InviteInternalServerError) Error() string {
	return fmt.Sprintf("[POST /invite][%d] inviteInternalServerError ", 500)
}

func (o *InviteInternalServerError) String() string {
	return fmt.Sprintf("[POST /invite][%d] inviteInternalServerError ", 500)
}

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

	return nil
}

/*
InviteBody invite body
swagger:model InviteBody
*/
type InviteBody struct {

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

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

// Validate validates this invite body
func (o *InviteBody) Validate(formats strfmt.Registry) error {
	return nil
}

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

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

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