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

const (
	RocketChatRocketChat RocketChat = "rocket-chat"
)

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

type SourceRocketChat struct {
	// Your rocket.chat instance URL.
	Endpoint string `json:"endpoint"`
	// Your API Token. See <a href="https://developer.rocket.chat/reference/api/rest-api/endpoints/other-important-endpoints/access-tokens-endpoints">here</a>. The token is case sensitive.
	Token string `json:"token"`
	// Your User Id.
	UserID     string     `json:"user_id"`
	sourceType RocketChat `const:"rocket-chat" json:"sourceType"`
}

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

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

func (o *SourceRocketChat) GetEndpoint() string {
	if o == nil {
		return ""
	}
	return o.Endpoint
}

func (o *SourceRocketChat) GetToken() string {
	if o == nil {
		return ""
	}
	return o.Token
}

func (o *SourceRocketChat) GetUserID() string {
	if o == nil {
		return ""
	}
	return o.UserID
}

func (o *SourceRocketChat) GetSourceType() RocketChat {
	return RocketChatRocketChat
}
