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

// 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/errors"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"

	"github.com/taxnexus/go/lib/api/pdf/pdf_models"
)

// GetPDFReader is a Reader for the GetPDF structure.
type GetPDFReader struct {
	formats strfmt.Registry
	writer  io.Writer
}

// ReadResponse reads a server response into the received o.
func (o *GetPDFReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetPDFOK(o.writer)
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetPDFUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetPDFForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetPDFNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetPDFUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetPDFInternalServerError()
		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())
	}
}

// NewGetPDFOK creates a GetPDFOK with default headers values
func NewGetPDFOK(writer io.Writer) *GetPDFOK {
	return &GetPDFOK{
		Payload: writer,
	}
}

/*GetPDFOK handles this case with default header values.

A PDF file
*/
type GetPDFOK struct {
	/*Specifies download file name
	 */
	ContentDisposition string
	/*The size of the file
	 */
	ContentLength int32
	/*The URL of the document
	 */
	ContentLocation string

	Payload io.Writer
}

func (o *GetPDFOK) Error() string {
	return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPDFOK  %+v", 200, o.Payload)
}

func (o *GetPDFOK) GetPayload() io.Writer {
	return o.Payload
}

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

	// response header Content-Disposition
	o.ContentDisposition = response.GetHeader("Content-Disposition")

	// response header Content-Length
	contentLength, err := swag.ConvertInt32(response.GetHeader("Content-Length"))
	if err != nil {
		return errors.InvalidType("Content-Length", "header", "int32", response.GetHeader("Content-Length"))
	}
	o.ContentLength = contentLength

	// response header Content-Location
	o.ContentLocation = response.GetHeader("Content-Location")

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

	return nil
}

// NewGetPDFUnauthorized creates a GetPDFUnauthorized with default headers values
func NewGetPDFUnauthorized() *GetPDFUnauthorized {
	return &GetPDFUnauthorized{}
}

/*GetPDFUnauthorized handles this case with default header values.

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

func (o *GetPDFUnauthorized) Error() string {
	return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPDFUnauthorized  %+v", 401, o.Payload)
}

func (o *GetPDFUnauthorized) GetPayload() *pdf_models.Error {
	return o.Payload
}

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

	o.Payload = new(pdf_models.Error)

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

	return nil
}

// NewGetPDFForbidden creates a GetPDFForbidden with default headers values
func NewGetPDFForbidden() *GetPDFForbidden {
	return &GetPDFForbidden{}
}

/*GetPDFForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type GetPDFForbidden struct {
	Payload *pdf_models.Error
}

func (o *GetPDFForbidden) Error() string {
	return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPDFForbidden  %+v", 403, o.Payload)
}

func (o *GetPDFForbidden) GetPayload() *pdf_models.Error {
	return o.Payload
}

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

	o.Payload = new(pdf_models.Error)

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

	return nil
}

// NewGetPDFNotFound creates a GetPDFNotFound with default headers values
func NewGetPDFNotFound() *GetPDFNotFound {
	return &GetPDFNotFound{}
}

/*GetPDFNotFound handles this case with default header values.

Resource was not found
*/
type GetPDFNotFound struct {
	Payload *pdf_models.Error
}

func (o *GetPDFNotFound) Error() string {
	return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPDFNotFound  %+v", 404, o.Payload)
}

func (o *GetPDFNotFound) GetPayload() *pdf_models.Error {
	return o.Payload
}

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

	o.Payload = new(pdf_models.Error)

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

	return nil
}

// NewGetPDFUnprocessableEntity creates a GetPDFUnprocessableEntity with default headers values
func NewGetPDFUnprocessableEntity() *GetPDFUnprocessableEntity {
	return &GetPDFUnprocessableEntity{}
}

/*GetPDFUnprocessableEntity handles this case with default header values.

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

func (o *GetPDFUnprocessableEntity) Error() string {
	return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPDFUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *GetPDFUnprocessableEntity) GetPayload() *pdf_models.Error {
	return o.Payload
}

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

	o.Payload = new(pdf_models.Error)

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

	return nil
}

// NewGetPDFInternalServerError creates a GetPDFInternalServerError with default headers values
func NewGetPDFInternalServerError() *GetPDFInternalServerError {
	return &GetPDFInternalServerError{}
}

/*GetPDFInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetPDFInternalServerError struct {
	Payload *pdf_models.Error
}

func (o *GetPDFInternalServerError) Error() string {
	return fmt.Sprintf("[GET /pdfs/{pdfId}][%d] getPDFInternalServerError  %+v", 500, o.Payload)
}

func (o *GetPDFInternalServerError) GetPayload() *pdf_models.Error {
	return o.Payload
}

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

	o.Payload = new(pdf_models.Error)

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

	return nil
}
