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

package models

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

import (
	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
)

// MockEvalRequest Request to evaluate a mock's behavior given an input context
//
// swagger:model MockEvalRequest
type MockEvalRequest struct {

	// The context to evaluate the mock
	Context *EvalContext `json:"context,omitempty"`

	// The mock to evaluate
	Mock *Mock `json:"mock,omitempty"`
}

// Validate validates this mock eval request
func (m *MockEvalRequest) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

func (m *MockEvalRequest) validateContext(formats strfmt.Registry) error {

	if swag.IsZero(m.Context) { // not required
		return nil
	}

	if m.Context != nil {
		if err := m.Context.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("context")
			}
			return err
		}
	}

	return nil
}

func (m *MockEvalRequest) validateMock(formats strfmt.Registry) error {

	if swag.IsZero(m.Mock) { // not required
		return nil
	}

	if m.Mock != nil {
		if err := m.Mock.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("mock")
			}
			return err
		}
	}

	return nil
}

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

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