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

const (
	ConfluenceConfluence Confluence = "confluence"
)

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

type SourceConfluence struct {
	// Please follow the Jira confluence for generating an API token: <a href="https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/">generating an API token</a>.
	APIToken string `json:"api_token"`
	// Your Confluence domain name
	DomainName string `json:"domain_name"`
	// Your Confluence login email
	Email      string     `json:"email"`
	sourceType Confluence `const:"confluence" json:"sourceType"`
}

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

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

func (o *SourceConfluence) GetAPIToken() string {
	if o == nil {
		return ""
	}
	return o.APIToken
}

func (o *SourceConfluence) GetDomainName() string {
	if o == nil {
		return ""
	}
	return o.DomainName
}

func (o *SourceConfluence) GetEmail() string {
	if o == nil {
		return ""
	}
	return o.Email
}

func (o *SourceConfluence) GetSourceType() Confluence {
	return ConfluenceConfluence
}
