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

package model

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

// OpenapiTiFlashNodeMap openapi ti flash node map
//
// swagger:model openapiTiFlashNodeMap
type OpenapiTiFlashNodeMap struct {

	// The availability zone of a node in the cluster.
	// Example: us-west-2a
	AvailabilityZone string `json:"availability_zone,omitempty"`

	// The name of a node in the cluster.
	// Example: tiflash-0
	NodeName string `json:"node_name,omitempty"`

	// The size of the TiFlash component in the cluster.
	// Example: 8C64G
	NodeSize string `json:"node_size,omitempty"`

	// The RAM size of a node in the cluster. If the `cluster_type` is `"DEVELOPER"`, `ram_bytes` is always 0.
	// Example: 68719476736
	RAMBytes string `json:"ram_bytes,omitempty"`

	// The status of a node in the cluster.
	// Example: NODE_STATUS_AVAILABLE
	// Enum: [NODE_STATUS_AVAILABLE NODE_STATUS_UNAVAILABLE NODE_STATUS_CREATING NODE_STATUS_DELETING]
	Status string `json:"status,omitempty"`

	// The storage size of a node in the cluster.
	// Example: 1024
	StorageSizeGib int32 `json:"storage_size_gib,omitempty"`

	// The total vCPUs of a node in the cluster. If the `cluster_type` is `"DEVELOPER"`, `vcpu_num` is always 0.
	// Example: 8
	VcpuNum int32 `json:"vcpu_num,omitempty"`
}

// Validate validates this openapi ti flash node map
func (m *OpenapiTiFlashNodeMap) Validate(formats strfmt.Registry) error {
	var res []error

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

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

var openapiTiFlashNodeMapTypeStatusPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["NODE_STATUS_AVAILABLE","NODE_STATUS_UNAVAILABLE","NODE_STATUS_CREATING","NODE_STATUS_DELETING"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		openapiTiFlashNodeMapTypeStatusPropEnum = append(openapiTiFlashNodeMapTypeStatusPropEnum, v)
	}
}

const (

	// OpenapiTiFlashNodeMapStatusNODESTATUSAVAILABLE captures enum value "NODE_STATUS_AVAILABLE"
	OpenapiTiFlashNodeMapStatusNODESTATUSAVAILABLE string = "NODE_STATUS_AVAILABLE"

	// OpenapiTiFlashNodeMapStatusNODESTATUSUNAVAILABLE captures enum value "NODE_STATUS_UNAVAILABLE"
	OpenapiTiFlashNodeMapStatusNODESTATUSUNAVAILABLE string = "NODE_STATUS_UNAVAILABLE"

	// OpenapiTiFlashNodeMapStatusNODESTATUSCREATING captures enum value "NODE_STATUS_CREATING"
	OpenapiTiFlashNodeMapStatusNODESTATUSCREATING string = "NODE_STATUS_CREATING"

	// OpenapiTiFlashNodeMapStatusNODESTATUSDELETING captures enum value "NODE_STATUS_DELETING"
	OpenapiTiFlashNodeMapStatusNODESTATUSDELETING string = "NODE_STATUS_DELETING"
)

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

func (m *OpenapiTiFlashNodeMap) validateStatus(formats strfmt.Registry) error {
	if swag.IsZero(m.Status) { // not required
		return nil
	}

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

	return nil
}

// ContextValidate validates this openapi ti flash node map based on context it is used
func (m *OpenapiTiFlashNodeMap) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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