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

// TableWidgetForecastConfiguration table widget forecast configuration
//
// swagger:model TableWidgetForecastConfiguration
type TableWidgetForecastConfiguration struct {

	// Forecast method for the widget :Linear | ARIMA
	// Read Only: true
	Algorithm string `json:"algorithm,omitempty"`

	// The percent confidence that should be required for a forecasted alert.
	// Read Only: true
	Confidence int32 `json:"confidence,omitempty"`

	// 	The minimum alert severity the forecasting should include, one of warn | error | critical
	// Read Only: true
	Severity string `json:"severity,omitempty"`

	// The training data time range (the data on which forecasting is calculated). Options are Last 7 days, Last 14 days, Last 30 days, Last calendar month, Last 365 days or a custom time range
	// Read Only: true
	TimeRange string `json:"timeRange,omitempty"`
}

// Validate validates this table widget forecast configuration
func (m *TableWidgetForecastConfiguration) Validate(formats strfmt.Registry) error {
	return nil
}

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

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

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

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

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

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

func (m *TableWidgetForecastConfiguration) contextValidateAlgorithm(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *TableWidgetForecastConfiguration) contextValidateConfidence(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *TableWidgetForecastConfiguration) contextValidateSeverity(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *TableWidgetForecastConfiguration) contextValidateTimeRange(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

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

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