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

type Chargedesk string

const (
	ChargedeskChargedesk Chargedesk = "chargedesk"
)

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

type SourceChargedesk struct {
	Password *string `json:"password,omitempty"`
	// Date from when the sync should start in epoch Unix timestamp
	StartDate  *int64     `json:"start_date,omitempty"`
	Username   string     `json:"username"`
	sourceType Chargedesk `const:"chargedesk" json:"sourceType"`
}

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

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

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

func (o *SourceChargedesk) GetStartDate() *int64 {
	if o == nil {
		return nil
	}
	return o.StartDate
}

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

func (o *SourceChargedesk) GetSourceType() Chargedesk {
	return ChargedeskChargedesk
}
