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

// SourceFinancialModellingUpdateTimeFrame - For example 1min, 5min, 15min, 30min, 1hour, 4hour
type SourceFinancialModellingUpdateTimeFrame string

const (
	SourceFinancialModellingUpdateTimeFrameOnemin     SourceFinancialModellingUpdateTimeFrame = "1min"
	SourceFinancialModellingUpdateTimeFrameFivemin    SourceFinancialModellingUpdateTimeFrame = "5min"
	SourceFinancialModellingUpdateTimeFrameFifteenmin SourceFinancialModellingUpdateTimeFrame = "15min"
	SourceFinancialModellingUpdateTimeFrameThirtymin  SourceFinancialModellingUpdateTimeFrame = "30min"
	SourceFinancialModellingUpdateTimeFrameOnehour    SourceFinancialModellingUpdateTimeFrame = "1hour"
	SourceFinancialModellingUpdateTimeFrameFourhour   SourceFinancialModellingUpdateTimeFrame = "4hour"
)

func (e SourceFinancialModellingUpdateTimeFrame) ToPointer() *SourceFinancialModellingUpdateTimeFrame {
	return &e
}
func (e *SourceFinancialModellingUpdateTimeFrame) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "1min":
		fallthrough
	case "5min":
		fallthrough
	case "15min":
		fallthrough
	case "30min":
		fallthrough
	case "1hour":
		fallthrough
	case "4hour":
		*e = SourceFinancialModellingUpdateTimeFrame(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceFinancialModellingUpdateTimeFrame: %v", v)
	}
}

type SourceFinancialModellingUpdate struct {
	APIKey string `json:"api_key"`
	// The stock exchange : AMEX, AMS, AQS, ASX, ATH, BER, BME, BRU, BSE, BUD, BUE, BVC, CAI, CBOE, CNQ, CPH, DFM, DOH, DUS, DXE, EGX, EURONEXT, HAM, HEL, HKSE, ICE, IOB, IST, JKT, JNB, JPX, KLS, KOE, KSC, KUW, LSE, MCX, MEX, MIL, MUN, NASDAQ, NEO, NSE, NYSE, NZE, OEM, OQX, OSL, OTC, PNK, PRA, RIS, SAO, SAU, SES, SET, SGO, SHH, SHZ, SIX, STO, STU, TAI, TLV, TSX, TSXV, TWO, VIE, VSE, WSE, XETRA
	Exchange *string `default:"NASDAQ" json:"exchange"`
	// Used in screener to filter out stocks with a market cap lower than the give marketcap
	Marketcaplowerthan *string `json:"marketcaplowerthan,omitempty"`
	// Used in screener to filter out stocks with a market cap more than the give marketcap
	Marketcapmorethan *string   `json:"marketcapmorethan,omitempty"`
	StartDate         time.Time `json:"start_date"`
	// For example 1min, 5min, 15min, 30min, 1hour, 4hour
	TimeFrame *SourceFinancialModellingUpdateTimeFrame `default:"4hour" json:"time_frame"`
}

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

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

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

func (o *SourceFinancialModellingUpdate) GetExchange() *string {
	if o == nil {
		return nil
	}
	return o.Exchange
}

func (o *SourceFinancialModellingUpdate) GetMarketcaplowerthan() *string {
	if o == nil {
		return nil
	}
	return o.Marketcaplowerthan
}

func (o *SourceFinancialModellingUpdate) GetMarketcapmorethan() *string {
	if o == nil {
		return nil
	}
	return o.Marketcapmorethan
}

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

func (o *SourceFinancialModellingUpdate) GetTimeFrame() *SourceFinancialModellingUpdateTimeFrame {
	if o == nil {
		return nil
	}
	return o.TimeFrame
}
