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

// DeviceGroupAlertThresholdInfo device group alert threshold info
//
// swagger:model DeviceGroupAlertThresholdInfo
type DeviceGroupAlertThresholdInfo struct {

	// alert enabled
	// Read Only: true
	AlertEnabled *bool `json:"alertEnabled,omitempty"`

	// alert expr
	// Read Only: true
	AlertExpr string `json:"alertExpr,omitempty"`

	// group full path
	// Read Only: true
	GroupFullPath string `json:"groupFullPath,omitempty"`

	// group Id
	// Read Only: true
	GroupID int32 `json:"groupId,omitempty"`

	// user permission
	// Read Only: true
	UserPermission string `json:"userPermission,omitempty"`
}

// Validate validates this device group alert threshold info
func (m *DeviceGroupAlertThresholdInfo) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validate this device group alert threshold info based on the context it is used
func (m *DeviceGroupAlertThresholdInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

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

func (m *DeviceGroupAlertThresholdInfo) contextValidateAlertEnabled(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "alertEnabled", "body", m.AlertEnabled); err != nil {
		return err
	}

	return nil
}

func (m *DeviceGroupAlertThresholdInfo) contextValidateAlertExpr(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "alertExpr", "body", string(m.AlertExpr)); err != nil {
		return err
	}

	return nil
}

func (m *DeviceGroupAlertThresholdInfo) contextValidateGroupFullPath(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "groupFullPath", "body", string(m.GroupFullPath)); err != nil {
		return err
	}

	return nil
}

func (m *DeviceGroupAlertThresholdInfo) contextValidateGroupID(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "groupId", "body", int32(m.GroupID)); err != nil {
		return err
	}

	return nil
}

func (m *DeviceGroupAlertThresholdInfo) contextValidateUserPermission(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "userPermission", "body", string(m.UserPermission)); err != nil {
		return err
	}

	return nil
}

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

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