// 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 Stockdata string

const (
	StockdataStockdata Stockdata = "stockdata"
)

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

type SourceStockdata struct {
	APIKey         string `json:"api_key"`
	FilterEntities *bool  `default:"false" json:"filter_entities"`
	// Specify the industries of entities which have been identified within the article.
	Industries []any     `json:"industries,omitempty"`
	StartDate  time.Time `json:"start_date"`
	Symbols    []any     `json:"symbols,omitempty"`
	sourceType Stockdata `const:"stockdata" json:"sourceType"`
}

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

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

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

func (o *SourceStockdata) GetFilterEntities() *bool {
	if o == nil {
		return nil
	}
	return o.FilterEntities
}

func (o *SourceStockdata) GetIndustries() []any {
	if o == nil {
		return nil
	}
	return o.Industries
}

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

func (o *SourceStockdata) GetSymbols() []any {
	if o == nil {
		return nil
	}
	return o.Symbols
}

func (o *SourceStockdata) GetSourceType() Stockdata {
	return StockdataStockdata
}
