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

package repository

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

	"src.opensuse.org/autogits/common/gitea-generated/models"
)

// RepoTrackedTimesReader is a Reader for the RepoTrackedTimes structure.
type RepoTrackedTimesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *RepoTrackedTimesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewRepoTrackedTimesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewRepoTrackedTimesBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewRepoTrackedTimesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewRepoTrackedTimesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /repos/{owner}/{repo}/times] repoTrackedTimes", response, response.Code())
	}
}

// NewRepoTrackedTimesOK creates a RepoTrackedTimesOK with default headers values
func NewRepoTrackedTimesOK() *RepoTrackedTimesOK {
	return &RepoTrackedTimesOK{}
}

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

TrackedTimeList
*/
type RepoTrackedTimesOK struct {
	Payload []*models.TrackedTime
}

// IsSuccess returns true when this repo tracked times o k response has a 2xx status code
func (o *RepoTrackedTimesOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this repo tracked times o k response has a 3xx status code
func (o *RepoTrackedTimesOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo tracked times o k response has a 4xx status code
func (o *RepoTrackedTimesOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this repo tracked times o k response has a 5xx status code
func (o *RepoTrackedTimesOK) IsServerError() bool {
	return false
}

// IsCode returns true when this repo tracked times o k response a status code equal to that given
func (o *RepoTrackedTimesOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the repo tracked times o k response
func (o *RepoTrackedTimesOK) Code() int {
	return 200
}

func (o *RepoTrackedTimesOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/times][%d] repoTrackedTimesOK %s", 200, payload)
}

func (o *RepoTrackedTimesOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/times][%d] repoTrackedTimesOK %s", 200, payload)
}

func (o *RepoTrackedTimesOK) GetPayload() []*models.TrackedTime {
	return o.Payload
}

func (o *RepoTrackedTimesOK) 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
}

// NewRepoTrackedTimesBadRequest creates a RepoTrackedTimesBadRequest with default headers values
func NewRepoTrackedTimesBadRequest() *RepoTrackedTimesBadRequest {
	return &RepoTrackedTimesBadRequest{}
}

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

APIError is error format response
*/
type RepoTrackedTimesBadRequest struct {
	Message string
	URL     string
}

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

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

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

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

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

// Code gets the status code for the repo tracked times bad request response
func (o *RepoTrackedTimesBadRequest) Code() int {
	return 400
}

func (o *RepoTrackedTimesBadRequest) Error() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/times][%d] repoTrackedTimesBadRequest", 400)
}

func (o *RepoTrackedTimesBadRequest) String() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/times][%d] repoTrackedTimesBadRequest", 400)
}

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

	// hydrates response header message
	hdrMessage := response.GetHeader("message")

	if hdrMessage != "" {
		o.Message = hdrMessage
	}

	// hydrates response header url
	hdrURL := response.GetHeader("url")

	if hdrURL != "" {
		o.URL = hdrURL
	}

	return nil
}

// NewRepoTrackedTimesForbidden creates a RepoTrackedTimesForbidden with default headers values
func NewRepoTrackedTimesForbidden() *RepoTrackedTimesForbidden {
	return &RepoTrackedTimesForbidden{}
}

/*
RepoTrackedTimesForbidden describes a response with status code 403, with default header values.

APIForbiddenError is a forbidden error response
*/
type RepoTrackedTimesForbidden struct {
	Message string
	URL     string
}

// IsSuccess returns true when this repo tracked times forbidden response has a 2xx status code
func (o *RepoTrackedTimesForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo tracked times forbidden response has a 3xx status code
func (o *RepoTrackedTimesForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo tracked times forbidden response has a 4xx status code
func (o *RepoTrackedTimesForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo tracked times forbidden response has a 5xx status code
func (o *RepoTrackedTimesForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this repo tracked times forbidden response a status code equal to that given
func (o *RepoTrackedTimesForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the repo tracked times forbidden response
func (o *RepoTrackedTimesForbidden) Code() int {
	return 403
}

func (o *RepoTrackedTimesForbidden) Error() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/times][%d] repoTrackedTimesForbidden", 403)
}

func (o *RepoTrackedTimesForbidden) String() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/times][%d] repoTrackedTimesForbidden", 403)
}

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

	// hydrates response header message
	hdrMessage := response.GetHeader("message")

	if hdrMessage != "" {
		o.Message = hdrMessage
	}

	// hydrates response header url
	hdrURL := response.GetHeader("url")

	if hdrURL != "" {
		o.URL = hdrURL
	}

	return nil
}

// NewRepoTrackedTimesNotFound creates a RepoTrackedTimesNotFound with default headers values
func NewRepoTrackedTimesNotFound() *RepoTrackedTimesNotFound {
	return &RepoTrackedTimesNotFound{}
}

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

APINotFound is a not found empty response
*/
type RepoTrackedTimesNotFound struct {
}

// IsSuccess returns true when this repo tracked times not found response has a 2xx status code
func (o *RepoTrackedTimesNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this repo tracked times not found response has a 3xx status code
func (o *RepoTrackedTimesNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this repo tracked times not found response has a 4xx status code
func (o *RepoTrackedTimesNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this repo tracked times not found response has a 5xx status code
func (o *RepoTrackedTimesNotFound) IsServerError() bool {
	return false
}

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

// Code gets the status code for the repo tracked times not found response
func (o *RepoTrackedTimesNotFound) Code() int {
	return 404
}

func (o *RepoTrackedTimesNotFound) Error() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/times][%d] repoTrackedTimesNotFound", 404)
}

func (o *RepoTrackedTimesNotFound) String() string {
	return fmt.Sprintf("[GET /repos/{owner}/{repo}/times][%d] repoTrackedTimesNotFound", 404)
}

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

	return nil
}
