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

// PinPolicy Specify PVM pin policy
//
// swagger:model PinPolicy
type PinPolicy string

func NewPinPolicy(value PinPolicy) *PinPolicy {
	return &value
}

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

const (

	// PinPolicyNone captures enum value "none"
	PinPolicyNone PinPolicy = "none"

	// PinPolicySoft captures enum value "soft"
	PinPolicySoft PinPolicy = "soft"

	// PinPolicyHard captures enum value "hard"
	PinPolicyHard PinPolicy = "hard"
)

// for schema
var pinPolicyEnum []interface{}

func init() {
	var res []PinPolicy
	if err := json.Unmarshal([]byte(`["none","soft","hard"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		pinPolicyEnum = append(pinPolicyEnum, v)
	}
}

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

// Validate validates this pin policy
func (m PinPolicy) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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