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

// GetJobSpecHandlerFunc turns a function with the right signature into a get job spec handler
type GetJobSpecHandlerFunc func(GetJobSpecParams) middleware.Responder

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

// GetJobSpecHandler interface for that can handle valid get job spec params
type GetJobSpecHandler interface {
	Handle(GetJobSpecParams) middleware.Responder
}

// NewGetJobSpec creates a new http.Handler for the get job spec operation
func NewGetJobSpec(ctx *middleware.Context, handler GetJobSpecHandler) *GetJobSpec {
	return &GetJobSpec{Context: ctx, Handler: handler}
}

/*
	GetJobSpec swagger:route POST /api/v1/jobSpec getJobSpec

GetJobSpec get job spec API
*/
type GetJobSpec struct {
	Context *middleware.Context
	Handler GetJobSpecHandler
}

func (o *GetJobSpec) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
	route, rCtx, _ := o.Context.RouteInfo(r)
	if rCtx != nil {
		*r = *rCtx
	}
	var Params = NewGetJobSpecParams()
	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)

}

// GetJobSpecBody get job spec body
//
// swagger:model GetJobSpecBody
type GetJobSpecBody struct {

	// job Id
	// Required: true
	JobID string `json:"jobId"`
}

// Validate validates this get job spec body
func (o *GetJobSpecBody) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (o *GetJobSpecBody) validateJobID(formats strfmt.Registry) error {

	if err := validate.RequiredString("getJobSpecRequest"+"."+"jobId", "body", o.JobID); err != nil {
		return err
	}

	return nil
}

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

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

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

// GetJobSpecOKBody get job spec o k body
//
// swagger:model GetJobSpecOKBody
type GetJobSpecOKBody struct {

	// Job Spec object
	Job interface{} `json:"job,omitempty"`
}

// Validate validates this get job spec o k body
func (o *GetJobSpecOKBody) Validate(formats strfmt.Registry) error {
	return nil
}

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

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

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