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

const (
	GreythrGreythr Greythr = "greythr"
)

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

type SourceGreythr struct {
	// https://api.greythr.com
	BaseURL string `json:"base_url"`
	// Your GreytHR Host URL
	Domain     string  `json:"domain"`
	Password   *string `json:"password,omitempty"`
	Username   string  `json:"username"`
	sourceType Greythr `const:"greythr" json:"sourceType"`
}

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

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

func (o *SourceGreythr) GetBaseURL() string {
	if o == nil {
		return ""
	}
	return o.BaseURL
}

func (o *SourceGreythr) GetDomain() string {
	if o == nil {
		return ""
	}
	return o.Domain
}

func (o *SourceGreythr) GetPassword() *string {
	if o == nil {
		return nil
	}
	return o.Password
}

func (o *SourceGreythr) GetUsername() string {
	if o == nil {
		return ""
	}
	return o.Username
}

func (o *SourceGreythr) GetSourceType() Greythr {
	return GreythrGreythr
}
