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

package operations

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

import (
	"context"
	"net/http"

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

// GetJobRunDebugMessageHandlerFunc turns a function with the right signature into a get job run debug message handler
type GetJobRunDebugMessageHandlerFunc func(GetJobRunDebugMessageParams) middleware.Responder

// Handle executing the request and returning a response
func (fn GetJobRunDebugMessageHandlerFunc) Handle(params GetJobRunDebugMessageParams) middleware.Responder {
	return fn(params)
}

// GetJobRunDebugMessageHandler interface for that can handle valid get job run debug message params
type GetJobRunDebugMessageHandler interface {
	Handle(GetJobRunDebugMessageParams) middleware.Responder
}

// NewGetJobRunDebugMessage creates a new http.Handler for the get job run debug message operation
func NewGetJobRunDebugMessage(ctx *middleware.Context, handler GetJobRunDebugMessageHandler) *GetJobRunDebugMessage {
	return &GetJobRunDebugMessage{Context: ctx, Handler: handler}
}

/*
	GetJobRunDebugMessage swagger:route POST /api/v1/jobRunDebugMessage getJobRunDebugMessage

GetJobRunDebugMessage get job run debug message API
*/
type GetJobRunDebugMessage struct {
	Context *middleware.Context
	Handler GetJobRunDebugMessageHandler
}

func (o *GetJobRunDebugMessage) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
	route, rCtx, _ := o.Context.RouteInfo(r)
	if rCtx != nil {
		*r = *rCtx
	}
	var Params = NewGetJobRunDebugMessageParams()
	if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
		o.Context.Respond(rw, r, route.Produces, route, err)
		return
	}

	res := o.Handler.Handle(Params) // actually handle the request
	o.Context.Respond(rw, r, route.Produces, route, res)

}

// GetJobRunDebugMessageBody get job run debug message body
//
// swagger:model GetJobRunDebugMessageBody
type GetJobRunDebugMessageBody struct {

	// run Id
	// Required: true
	RunID string `json:"runId"`
}

// Validate validates this get job run debug message body
func (o *GetJobRunDebugMessageBody) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (o *GetJobRunDebugMessageBody) validateRunID(formats strfmt.Registry) error {

	if err := validate.RequiredString("getJobRunDebugMessageRequest"+"."+"runId", "body", o.RunID); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this get job run debug message body based on context it is used
func (o *GetJobRunDebugMessageBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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

// GetJobRunDebugMessageOKBody get job run debug message o k body
//
// swagger:model GetJobRunDebugMessageOKBody
type GetJobRunDebugMessageOKBody struct {

	// Debug message for individual job run
	ErrorString string `json:"errorString,omitempty"`
}

// Validate validates this get job run debug message o k body
func (o *GetJobRunDebugMessageOKBody) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this get job run debug message o k body based on context it is used
func (o *GetJobRunDebugMessageOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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