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

const (
	GmailGmail Gmail = "gmail"
)

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

type SourceGmail struct {
	ClientID           string `json:"client_id"`
	ClientRefreshToken string `json:"client_refresh_token"`
	ClientSecret       string `json:"client_secret"`
	// Include drafts/messages from SPAM and TRASH in the results. Defaults to false.
	IncludeSpamAndTrash *bool `default:"false" json:"include_spam_and_trash"`
	sourceType          Gmail `const:"gmail" json:"sourceType"`
}

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

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

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

func (o *SourceGmail) GetClientRefreshToken() string {
	if o == nil {
		return ""
	}
	return o.ClientRefreshToken
}

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

func (o *SourceGmail) GetIncludeSpamAndTrash() *bool {
	if o == nil {
		return nil
	}
	return o.IncludeSpamAndTrash
}

func (o *SourceGmail) GetSourceType() Gmail {
	return GmailGmail
}
