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

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

// MockEvalResponse Result of evaluating mock, indicates what the mock would be expected to do given the input
//
// swagger:model MockEvalResponse
type MockEvalResponse struct {

	// list of responses the mock performed (assuming the condition passed)
	ActionsPerformed []*ActionPerformed `json:"actions_performed"`

	// whether the condition passed when evaluated, so the actions would take place
	ConditionPassed bool `json:"condition_passed,omitempty"`

	// the rendered value of the mock's expect's condition when evaluating with the context
	ConditionRendered string `json:"condition_rendered,omitempty"`

	// whether the channel-specific condition of the evaluation passed. For example for a mock with ExpectHTTP, this returns true if the HTTP path and method in the input context matched the ExpectHTTP.
	ExpectPassed bool `json:"expect_passed,omitempty"`
}

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

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

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

func (m *MockEvalResponse) validateActionsPerformed(formats strfmt.Registry) error {

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

	for i := 0; i < len(m.ActionsPerformed); i++ {
		if swag.IsZero(m.ActionsPerformed[i]) { // not required
			continue
		}

		if m.ActionsPerformed[i] != nil {
			if err := m.ActionsPerformed[i].Validate(formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("actions_performed" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

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

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