/*
 * Redfish OAPI specification
 *
 * Partial Redfish OAPI specification for a limited client
 *
 * API version: 0.0.1
 */

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package client

import (
	"encoding/json"
	"fmt"
)

// BootSource the model 'BootSource'
type BootSource string

// List of BootSource
const (
	BOOTSOURCE_NONE BootSource = "None"
	BOOTSOURCE_PXE BootSource = "Pxe"
	BOOTSOURCE_FLOPPY BootSource = "Floppy"
	BOOTSOURCE_CD BootSource = "Cd"
	BOOTSOURCE_USB BootSource = "Usb"
	BOOTSOURCE_HDD BootSource = "Hdd"
	BOOTSOURCE_BIOS_SETUP BootSource = "BiosSetup"
	BOOTSOURCE_UTILITIES BootSource = "Utilities"
	BOOTSOURCE_DIAGS BootSource = "Diags"
	BOOTSOURCE_UEFI_SHELL BootSource = "UefiShell"
	BOOTSOURCE_UEFI_TARGET BootSource = "UefiTarget"
	BOOTSOURCE_SD_CARD BootSource = "SDCard"
	BOOTSOURCE_UEFI_HTTP BootSource = "UefiHttp"
	BOOTSOURCE_REMOTE_DRIVE BootSource = "RemoteDrive"
	BOOTSOURCE_UEFI_BOOT_NEXT BootSource = "UefiBootNext"
)

func (v *BootSource) UnmarshalJSON(src []byte) error {
	var value string
	err := json.Unmarshal(src, &value)
	if err != nil {
		return err
	}
	enumTypeValue := BootSource(value)
	for _, existing := range []BootSource{ "None", "Pxe", "Floppy", "Cd", "Usb", "Hdd", "BiosSetup", "Utilities", "Diags", "UefiShell", "UefiTarget", "SDCard", "UefiHttp", "RemoteDrive", "UefiBootNext",   } {
		if existing == enumTypeValue {
			*v = enumTypeValue
			return nil
		}
	}

	return fmt.Errorf("%+v is not a valid BootSource", value)
}

// Ptr returns reference to BootSource value
func (v BootSource) Ptr() *BootSource {
	return &v
}

type NullableBootSource struct {
	value *BootSource
	isSet bool
}

func (v NullableBootSource) Get() *BootSource {
	return v.value
}

func (v *NullableBootSource) Set(val *BootSource) {
	v.value = val
	v.isSet = true
}

func (v NullableBootSource) IsSet() bool {
	return v.isSet
}

func (v *NullableBootSource) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableBootSource(val *BootSource) *NullableBootSource {
	return &NullableBootSource{value: val, isSet: true}
}

func (v NullableBootSource) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableBootSource) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}