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

package shared

import (
	"encoding/json"
	"fmt"
	"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/internal/utils"
)

type Tmdb string

const (
	TmdbTmdb Tmdb = "tmdb"
)

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

type SourceTmdb struct {
	// API Key from tmdb account
	APIKey string `json:"api_key"`
	// Language expressed in ISO 639-1 scheme, Mandate for required streams (Example en-US)
	Language string `json:"language"`
	// Target movie ID, Mandate for movie streams (Example is 550)
	MovieID string `json:"movie_id"`
	// Target movie ID, Mandate for search streams
	Query      string `json:"query"`
	sourceType Tmdb   `const:"tmdb" json:"sourceType"`
}

func (s SourceTmdb) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceTmdb) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil {
		return err
	}
	return nil
}

func (o *SourceTmdb) GetAPIKey() string {
	if o == nil {
		return ""
	}
	return o.APIKey
}

func (o *SourceTmdb) GetLanguage() string {
	if o == nil {
		return ""
	}
	return o.Language
}

func (o *SourceTmdb) GetMovieID() string {
	if o == nil {
		return ""
	}
	return o.MovieID
}

func (o *SourceTmdb) GetQuery() string {
	if o == nil {
		return ""
	}
	return o.Query
}

func (o *SourceTmdb) GetSourceType() Tmdb {
	return TmdbTmdb
}
