// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.

package components

import (
	"encoding/json"
	"fmt"
)

type Location string

const (
	LocationLan      Location = "lan"
	LocationWan      Location = "wan"
	LocationCellular Location = "cellular"
)

func (e Location) ToPointer() *Location {
	return &e
}
func (e *Location) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "lan":
		fallthrough
	case "wan":
		fallthrough
	case "cellular":
		*e = Location(v)
		return nil
	default:
		return fmt.Errorf("invalid value for Location: %v", v)
	}
}
