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

	strfmt "github.com/go-openapi/strfmt"

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

// State state
// swagger:model State

type State string

const (
	// StateRUNNING captures enum value "RUNNING"
	StateRUNNING State = "RUNNING"
	// StateFINISHED captures enum value "FINISHED"
	StateFINISHED State = "FINISHED"
	// StateERROR captures enum value "ERROR"
	StateERROR State = "ERROR"
	// StateABORTED captures enum value "ABORTED"
	StateABORTED State = "ABORTED"
	// StateACTIONREQUIRED captures enum value "ACTION_REQUIRED"
	StateACTIONREQUIRED State = "ACTION_REQUIRED"
)

// for schema
var stateEnum []interface{}

func init() {
	var res []State
	if err := json.Unmarshal([]byte(`["RUNNING","FINISHED","ERROR","ABORTED","ACTION_REQUIRED"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		stateEnum = append(stateEnum, v)
	}
}

func (m State) validateStateEnum(path, location string, value State) error {
	if err := validate.Enum(path, location, value, stateEnum); err != nil {
		return err
	}
	return nil
}

// Validate validates this state
func (m State) Validate(formats strfmt.Registry) error {
	var res []error

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

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