// Code generated by go-swagger; DO NOT EDIT.

package ops

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

// OperationInstancePhase operation instance phase
//
// swagger:model operation.InstancePhase
type OperationInstancePhase string

func NewOperationInstancePhase(value OperationInstancePhase) *OperationInstancePhase {
	return &value
}

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

const (

	// OperationInstancePhaseCreated captures enum value "created"
	OperationInstancePhaseCreated OperationInstancePhase = "created"

	// OperationInstancePhaseApproving captures enum value "approving"
	OperationInstancePhaseApproving OperationInstancePhase = "approving"

	// OperationInstancePhaseWithdrawn captures enum value "withdrawn"
	OperationInstancePhaseWithdrawn OperationInstancePhase = "withdrawn"

	// OperationInstancePhasePending captures enum value "pending"
	OperationInstancePhasePending OperationInstancePhase = "pending"

	// OperationInstancePhaseRunning captures enum value "running"
	OperationInstancePhaseRunning OperationInstancePhase = "running"

	// OperationInstancePhaseSucceeded captures enum value "succeeded"
	OperationInstancePhaseSucceeded OperationInstancePhase = "succeeded"

	// OperationInstancePhaseFailed captures enum value "failed"
	OperationInstancePhaseFailed OperationInstancePhase = "failed"

	// OperationInstancePhaseCanceled captures enum value "canceled"
	OperationInstancePhaseCanceled OperationInstancePhase = "canceled"
)

// for schema
var operationInstancePhaseEnum []interface{}

func init() {
	var res []OperationInstancePhase
	if err := json.Unmarshal([]byte(`["created","approving","withdrawn","pending","running","succeeded","failed","canceled"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		operationInstancePhaseEnum = append(operationInstancePhaseEnum, v)
	}
}

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

// Validate validates this operation instance phase
func (m OperationInstancePhase) Validate(formats strfmt.Registry) error {
	var res []error

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

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

// ContextValidate validates this operation instance phase based on context it is used
func (m OperationInstancePhase) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}
