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

const (
	GoogleCalendarGoogleCalendar GoogleCalendar = "google-calendar"
)

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

type SourceGoogleCalendar struct {
	Calendarid          string         `json:"calendarid"`
	ClientID            string         `json:"client_id"`
	ClientRefreshToken2 string         `json:"client_refresh_token_2"`
	ClientSecret        string         `json:"client_secret"`
	sourceType          GoogleCalendar `const:"google-calendar" json:"sourceType"`
}

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

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

func (o *SourceGoogleCalendar) GetCalendarid() string {
	if o == nil {
		return ""
	}
	return o.Calendarid
}

func (o *SourceGoogleCalendar) GetClientID() string {
	if o == nil {
		return ""
	}
	return o.ClientID
}

func (o *SourceGoogleCalendar) GetClientRefreshToken2() string {
	if o == nil {
		return ""
	}
	return o.ClientRefreshToken2
}

func (o *SourceGoogleCalendar) GetClientSecret() string {
	if o == nil {
		return ""
	}
	return o.ClientSecret
}

func (o *SourceGoogleCalendar) GetSourceType() GoogleCalendar {
	return GoogleCalendarGoogleCalendar
}
