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

const (
	InsightfulInsightful Insightful = "insightful"
)

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

type SourceInsightful struct {
	// Your API token for accessing the Insightful API. Generate it by logging in as an Admin to your organization's account, navigating to the API page, and creating a new token. Note that this token will only be shown once, so store it securely.
	APIToken   string     `json:"api_token"`
	StartDate  time.Time  `json:"start_date"`
	sourceType Insightful `const:"insightful" json:"sourceType"`
}

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

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

func (o *SourceInsightful) GetAPIToken() string {
	if o == nil {
		return ""
	}
	return o.APIToken
}

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

func (o *SourceInsightful) GetSourceType() Insightful {
	return InsightfulInsightful
}
