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

const (
	SendowlSendowl Sendowl = "sendowl"
)

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

type SourceSendowl struct {
	// Enter your API secret
	Password  *string   `json:"password,omitempty"`
	StartDate time.Time `json:"start_date"`
	// Enter you API Key
	Username   string  `json:"username"`
	sourceType Sendowl `const:"sendowl" json:"sourceType"`
}

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

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

func (o *SourceSendowl) GetPassword() *string {
	if o == nil {
		return nil
	}
	return o.Password
}

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

func (o *SourceSendowl) GetUsername() string {
	if o == nil {
		return ""
	}
	return o.Username
}

func (o *SourceSendowl) GetSourceType() Sendowl {
	return SendowlSendowl
}
