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

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

// Options options
//
// swagger:model Options
type Options struct {

	// vpnaas options
	// Required: true
	VpnaasOptions *VPNaaSOptions `json:"vpnaasOptions"`
}

// Validate validates this options
func (m *Options) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *Options) validateVpnaasOptions(formats strfmt.Registry) error {

	if err := validate.Required("vpnaasOptions", "body", m.VpnaasOptions); err != nil {
		return err
	}

	if m.VpnaasOptions != nil {
		if err := m.VpnaasOptions.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("vpnaasOptions")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("vpnaasOptions")
			}
			return err
		}
	}

	return nil
}

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

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

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

func (m *Options) contextValidateVpnaasOptions(ctx context.Context, formats strfmt.Registry) error {

	if m.VpnaasOptions != nil {

		if err := m.VpnaasOptions.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("vpnaasOptions")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("vpnaasOptions")
			}
			return err
		}
	}

	return nil
}

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

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