// 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 (
	"context"
	stderrors "errors"

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

// V1alpha1GetTasksResponse v1alpha1 get tasks response
//
// swagger:model v1alpha1GetTasksResponse
type V1alpha1GetTasksResponse struct {

	// The list of tasks per Agentic Service type
	Result map[string]GetTasksResponseTaskList `json:"result,omitempty"`
}

// Validate validates this v1alpha1 get tasks response
func (m *V1alpha1GetTasksResponse) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *V1alpha1GetTasksResponse) validateResult(formats strfmt.Registry) error {
	if swag.IsZero(m.Result) { // not required
		return nil
	}

	for k := range m.Result {

		if err := validate.Required("result"+"."+k, "body", m.Result[k]); err != nil {
			return err
		}
		if val, ok := m.Result[k]; ok {
			if err := val.Validate(formats); err != nil {
				ve := new(errors.Validation)
				if stderrors.As(err, &ve) {
					return ve.ValidateName("result" + "." + k)
				}
				ce := new(errors.CompositeError)
				if stderrors.As(err, &ce) {
					return ce.ValidateName("result" + "." + k)
				}

				return err
			}
		}

	}

	return nil
}

// ContextValidate validate this v1alpha1 get tasks response based on the context it is used
func (m *V1alpha1GetTasksResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

func (m *V1alpha1GetTasksResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error {

	for k := range m.Result {

		if val, ok := m.Result[k]; ok {
			if err := val.ContextValidate(ctx, formats); err != nil {
				return err
			}
		}

	}

	return nil
}

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

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