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

package components

import (
	"encoding/json"
	"fmt"
)

type Protocol string

const (
	ProtocolHTTP Protocol = "http"
	ProtocolHls  Protocol = "hls"
	ProtocolDash Protocol = "dash"
)

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