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

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

package auth

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

import (
	"fmt"
	"io"

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

	"github.com/taxnexus/go/lib/api/auth0/auth0_models"
)

// PostCredentialsReader is a Reader for the PostCredentials structure.
type PostCredentialsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCredentialsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostCredentialsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostCredentialsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostCredentialsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostCredentialsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostCredentialsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostCredentialsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}

// NewPostCredentialsOK creates a PostCredentialsOK with default headers values
func NewPostCredentialsOK() *PostCredentialsOK {
	return &PostCredentialsOK{}
}

/*PostCredentialsOK handles this case with default header values.

Credentials response from Auth0
*/
type PostCredentialsOK struct {
	Payload *auth0_models.CredentialsResponse
}

func (o *PostCredentialsOK) Error() string {
	return fmt.Sprintf("[POST /oauth/token][%d] postCredentialsOK  %+v", 200, o.Payload)
}

func (o *PostCredentialsOK) GetPayload() *auth0_models.CredentialsResponse {
	return o.Payload
}

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

	o.Payload = new(auth0_models.CredentialsResponse)

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

	return nil
}

// NewPostCredentialsUnauthorized creates a PostCredentialsUnauthorized with default headers values
func NewPostCredentialsUnauthorized() *PostCredentialsUnauthorized {
	return &PostCredentialsUnauthorized{}
}

/*PostCredentialsUnauthorized handles this case with default header values.

Access Unauthorized, invalid API-KEY was used
*/
type PostCredentialsUnauthorized struct {
	Payload *auth0_models.Error
}

func (o *PostCredentialsUnauthorized) Error() string {
	return fmt.Sprintf("[POST /oauth/token][%d] postCredentialsUnauthorized  %+v", 401, o.Payload)
}

func (o *PostCredentialsUnauthorized) GetPayload() *auth0_models.Error {
	return o.Payload
}

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

	o.Payload = new(auth0_models.Error)

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

	return nil
}

// NewPostCredentialsForbidden creates a PostCredentialsForbidden with default headers values
func NewPostCredentialsForbidden() *PostCredentialsForbidden {
	return &PostCredentialsForbidden{}
}

/*PostCredentialsForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type PostCredentialsForbidden struct {
	Payload *auth0_models.Error
}

func (o *PostCredentialsForbidden) Error() string {
	return fmt.Sprintf("[POST /oauth/token][%d] postCredentialsForbidden  %+v", 403, o.Payload)
}

func (o *PostCredentialsForbidden) GetPayload() *auth0_models.Error {
	return o.Payload
}

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

	o.Payload = new(auth0_models.Error)

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

	return nil
}

// NewPostCredentialsNotFound creates a PostCredentialsNotFound with default headers values
func NewPostCredentialsNotFound() *PostCredentialsNotFound {
	return &PostCredentialsNotFound{}
}

/*PostCredentialsNotFound handles this case with default header values.

Resource was not found
*/
type PostCredentialsNotFound struct {
	Payload *auth0_models.Error
}

func (o *PostCredentialsNotFound) Error() string {
	return fmt.Sprintf("[POST /oauth/token][%d] postCredentialsNotFound  %+v", 404, o.Payload)
}

func (o *PostCredentialsNotFound) GetPayload() *auth0_models.Error {
	return o.Payload
}

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

	o.Payload = new(auth0_models.Error)

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

	return nil
}

// NewPostCredentialsUnprocessableEntity creates a PostCredentialsUnprocessableEntity with default headers values
func NewPostCredentialsUnprocessableEntity() *PostCredentialsUnprocessableEntity {
	return &PostCredentialsUnprocessableEntity{}
}

/*PostCredentialsUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PostCredentialsUnprocessableEntity struct {
	Payload *auth0_models.Error
}

func (o *PostCredentialsUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /oauth/token][%d] postCredentialsUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *PostCredentialsUnprocessableEntity) GetPayload() *auth0_models.Error {
	return o.Payload
}

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

	o.Payload = new(auth0_models.Error)

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

	return nil
}

// NewPostCredentialsInternalServerError creates a PostCredentialsInternalServerError with default headers values
func NewPostCredentialsInternalServerError() *PostCredentialsInternalServerError {
	return &PostCredentialsInternalServerError{}
}

/*PostCredentialsInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostCredentialsInternalServerError struct {
	Payload *auth0_models.Error
}

func (o *PostCredentialsInternalServerError) Error() string {
	return fmt.Sprintf("[POST /oauth/token][%d] postCredentialsInternalServerError  %+v", 500, o.Payload)
}

func (o *PostCredentialsInternalServerError) GetPayload() *auth0_models.Error {
	return o.Payload
}

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

	o.Payload = new(auth0_models.Error)

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

	return nil
}
