// 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/swag"
	"github.com/go-openapi/validate"
)

// PvmInstanceDeployment pvm instance deployment
//
// swagger:model PvmInstanceDeployment
type PvmInstanceDeployment struct {

	// Machine type used to host the instance
	MachineType string `json:"machineType,omitempty"`

	// VM pin policy to use [none, soft, hard]
	PinPolicy string `json:"pinPolicy,omitempty"`

	// Processor mode (dedicated, shared, capped)
	// Required: true
	// Enum: [dedicated shared capped]
	ProcessorMode *string `json:"processorMode"`

	// Type of Deployment [SAP-RISE, EPIC]
	Type string `json:"type,omitempty"`
}

// Validate validates this pvm instance deployment
func (m *PvmInstanceDeployment) Validate(formats strfmt.Registry) error {
	var res []error

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

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

var pvmInstanceDeploymentTypeProcessorModePropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["dedicated","shared","capped"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		pvmInstanceDeploymentTypeProcessorModePropEnum = append(pvmInstanceDeploymentTypeProcessorModePropEnum, v)
	}
}

const (

	// PvmInstanceDeploymentProcessorModeDedicated captures enum value "dedicated"
	PvmInstanceDeploymentProcessorModeDedicated string = "dedicated"

	// PvmInstanceDeploymentProcessorModeShared captures enum value "shared"
	PvmInstanceDeploymentProcessorModeShared string = "shared"

	// PvmInstanceDeploymentProcessorModeCapped captures enum value "capped"
	PvmInstanceDeploymentProcessorModeCapped string = "capped"
)

// prop value enum
func (m *PvmInstanceDeployment) validateProcessorModeEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, pvmInstanceDeploymentTypeProcessorModePropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *PvmInstanceDeployment) validateProcessorMode(formats strfmt.Registry) error {

	if err := validate.Required("processorMode", "body", m.ProcessorMode); err != nil {
		return err
	}

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

	return nil
}

// ContextValidate validates this pvm instance deployment based on context it is used
func (m *PvmInstanceDeployment) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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