// 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"
	"time"
)

// SourceAssemblyaiUpdateSubtitleFormat - The subtitle format for transcript_subtitle stream
type SourceAssemblyaiUpdateSubtitleFormat string

const (
	SourceAssemblyaiUpdateSubtitleFormatVtt SourceAssemblyaiUpdateSubtitleFormat = "vtt"
	SourceAssemblyaiUpdateSubtitleFormatSrt SourceAssemblyaiUpdateSubtitleFormat = "srt"
)

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

type SourceAssemblyaiUpdate struct {
	// Your AssemblyAI API key. You can find it in the AssemblyAI dashboard at https://www.assemblyai.com/app/api-keys.
	APIKey string `json:"api_key"`
	// The request ID for LeMur responses
	RequestID *string   `json:"request_id,omitempty"`
	StartDate time.Time `json:"start_date"`
	// The subtitle format for transcript_subtitle stream
	SubtitleFormat *SourceAssemblyaiUpdateSubtitleFormat `default:"srt" json:"subtitle_format"`
}

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

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

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

func (o *SourceAssemblyaiUpdate) GetRequestID() *string {
	if o == nil {
		return nil
	}
	return o.RequestID
}

func (o *SourceAssemblyaiUpdate) GetStartDate() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.StartDate
}

func (o *SourceAssemblyaiUpdate) GetSubtitleFormat() *SourceAssemblyaiUpdateSubtitleFormat {
	if o == nil {
		return nil
	}
	return o.SubtitleFormat
}
