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

const (
	DingConnectDingConnect DingConnect = "ding-connect"
)

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

type SourceDingConnect struct {
	// Optional header to correlate HTTP requests between a client and server.
	XCorrelationID *string `json:"X-Correlation-Id,omitempty"`
	// Your API key for authenticating with the DingConnect API. You can generate this key by navigating to the Developer tab in the Account Settings section of your DingConnect account.
	APIKey     string      `json:"api_key"`
	StartDate  time.Time   `json:"start_date"`
	sourceType DingConnect `const:"ding-connect" json:"sourceType"`
}

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

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

func (o *SourceDingConnect) GetXCorrelationID() *string {
	if o == nil {
		return nil
	}
	return o.XCorrelationID
}

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

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

func (o *SourceDingConnect) GetSourceType() DingConnect {
	return DingConnectDingConnect
}
