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

const (
	SolarwindsServiceDeskSolarwindsServiceDesk SolarwindsServiceDesk = "solarwinds-service-desk"
)

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

type SourceSolarwindsServiceDesk struct {
	// Refer to `https://documentation.solarwinds.com/en/success_center/swsd/content/completeguidetoswsd/token-authentication-for-api-integration.htm#link4`
	APIKey2    string                `json:"api_key_2"`
	StartDate  time.Time             `json:"start_date"`
	sourceType SolarwindsServiceDesk `const:"solarwinds-service-desk" json:"sourceType"`
}

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

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

func (o *SourceSolarwindsServiceDesk) GetAPIKey2() string {
	if o == nil {
		return ""
	}
	return o.APIKey2
}

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

func (o *SourceSolarwindsServiceDesk) GetSourceType() SolarwindsServiceDesk {
	return SolarwindsServiceDeskSolarwindsServiceDesk
}
