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

package components

import (
	"encoding/json"
	"fmt"
)

type TranscodeType string

const (
	TranscodeTypeVideo     TranscodeType = "video"
	TranscodeTypeMusic     TranscodeType = "music"
	TranscodeTypeAudio     TranscodeType = "audio"
	TranscodeTypeSubtitles TranscodeType = "subtitles"
)

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