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

const (
	RingcentralRingcentral Ringcentral = "ringcentral"
)

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

type SourceRingcentral struct {
	// Could be seen at response to basic api call to an endpoint with ~ operator.  Example- (https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/business-hours)
	//
	AccountID string `json:"account_id"`
	// Token could be recieved by following instructions at https://developers.ringcentral.com/api-reference/authentication
	AuthToken string `json:"auth_token"`
	// Could be seen at response to basic api call to an endpoint with ~ operator.  Example- (https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/business-hours)
	//
	ExtensionID string      `json:"extension_id"`
	sourceType  Ringcentral `const:"ringcentral" json:"sourceType"`
}

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

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

func (o *SourceRingcentral) GetAccountID() string {
	if o == nil {
		return ""
	}
	return o.AccountID
}

func (o *SourceRingcentral) GetAuthToken() string {
	if o == nil {
		return ""
	}
	return o.AuthToken
}

func (o *SourceRingcentral) GetExtensionID() string {
	if o == nil {
		return ""
	}
	return o.ExtensionID
}

func (o *SourceRingcentral) GetSourceType() Ringcentral {
	return RingcentralRingcentral
}
