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

type Watchmode string

const (
	WatchmodeWatchmode Watchmode = "watchmode"
)

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

type SourceWatchmode struct {
	// Your API key for authenticating with the Watchmode API. You can request a free API key at https://api.watchmode.com/requestApiKey/.
	APIKey string `json:"api_key"`
	// The name value for search stream
	SearchVal  *string   `default:"Terminator" json:"search_val"`
	StartDate  time.Time `json:"start_date"`
	sourceType Watchmode `const:"watchmode" json:"sourceType"`
}

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

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

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

func (o *SourceWatchmode) GetSearchVal() *string {
	if o == nil {
		return nil
	}
	return o.SearchVal
}

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

func (o *SourceWatchmode) GetSourceType() Watchmode {
	return WatchmodeWatchmode
}
