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

// LogService20210330CreateDestinationFilterRequest log service 20210330 create destination filter request
//
// swagger:model log_service_20210330CreateDestinationFilterRequest
type LogService20210330CreateDestinationFilterRequest struct {

	// destination_id is the destination associated with the filter
	DestinationID string `json:"destination_id,omitempty"`

	// filter_type is the destination filter type to create.
	FilterType *LogService20210330DestinationFilterType `json:"filter_type,omitempty"`

	// organization_id is the organization holding the destination and filter
	OrganizationID string `json:"organization_id,omitempty"`
}

// Validate validates this log service 20210330 create destination filter request
func (m *LogService20210330CreateDestinationFilterRequest) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *LogService20210330CreateDestinationFilterRequest) validateFilterType(formats strfmt.Registry) error {
	if swag.IsZero(m.FilterType) { // not required
		return nil
	}

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

	return nil
}

// ContextValidate validate this log service 20210330 create destination filter request based on the context it is used
func (m *LogService20210330CreateDestinationFilterRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

func (m *LogService20210330CreateDestinationFilterRequest) contextValidateFilterType(ctx context.Context, formats strfmt.Registry) error {

	if m.FilterType != nil {

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

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

	return nil
}

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

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