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

package evaluate

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

import (
	"net/http"

	"github.com/go-openapi/runtime/middleware"
)

// EvaluateHandlerFunc turns a function with the right signature into a evaluate handler
type EvaluateHandlerFunc func(EvaluateParams) middleware.Responder

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

// EvaluateHandler interface for that can handle valid evaluate params
type EvaluateHandler interface {
	Handle(EvaluateParams) middleware.Responder
}

// NewEvaluate creates a new http.Handler for the evaluate operation
func NewEvaluate(ctx *middleware.Context, handler EvaluateHandler) *Evaluate {
	return &Evaluate{Context: ctx, Handler: handler}
}

/*Evaluate swagger:route POST /evaluate evaluate evaluate

evaluates a mock's response to a given input context, for debugging / development purposes

*/
type Evaluate struct {
	Context *middleware.Context
	Handler EvaluateHandler
}

func (o *Evaluate) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
	route, rCtx, _ := o.Context.RouteInfo(r)
	if rCtx != nil {
		r = rCtx
	}
	var Params = NewEvaluateParams()

	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)

}
