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

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

// CommonAggregation  - HOUR: Hour.
//   - DAY: Day.
//   - MONTH: Month.
//   - MINUTE: Minute.
//
// swagger:model commonAggregation
type CommonAggregation string

func NewCommonAggregation(value CommonAggregation) *CommonAggregation {
	return &value
}

// Pointer returns a pointer to a freshly-allocated CommonAggregation.
func (m CommonAggregation) Pointer() *CommonAggregation {
	return &m
}

const (

	// CommonAggregationHOUR captures enum value "HOUR"
	CommonAggregationHOUR CommonAggregation = "HOUR"

	// CommonAggregationDAY captures enum value "DAY"
	CommonAggregationDAY CommonAggregation = "DAY"

	// CommonAggregationMONTH captures enum value "MONTH"
	CommonAggregationMONTH CommonAggregation = "MONTH"

	// CommonAggregationMINUTE captures enum value "MINUTE"
	CommonAggregationMINUTE CommonAggregation = "MINUTE"
)

// for schema
var commonAggregationEnum []interface{}

func init() {
	var res []CommonAggregation
	if err := json.Unmarshal([]byte(`["HOUR","DAY","MONTH","MINUTE"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		commonAggregationEnum = append(commonAggregationEnum, v)
	}
}

func (m CommonAggregation) validateCommonAggregationEnum(path, location string, value CommonAggregation) error {
	if err := validate.EnumCase(path, location, value, commonAggregationEnum, true); err != nil {
		return err
	}
	return nil
}

// Validate validates this common aggregation
func (m CommonAggregation) Validate(formats strfmt.Registry) error {
	var res []error

	// value enum
	if err := m.validateCommonAggregationEnum("", "body", m); err != nil {
		return err
	}

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

// ContextValidate validates this common aggregation based on context it is used
func (m CommonAggregation) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}
