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

const (
	AkeneoAkeneo Akeneo = "akeneo"
)

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

type SourceAkeneo struct {
	APIUsername string `json:"api_username"`
	ClientID    string `json:"client_id"`
	// https://cb8715249e.trial.akeneo.cloud
	Host       string  `json:"host"`
	Password   string  `json:"password"`
	Secret     *string `json:"secret,omitempty"`
	sourceType Akeneo  `const:"akeneo" json:"sourceType"`
}

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

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

func (o *SourceAkeneo) GetAPIUsername() string {
	if o == nil {
		return ""
	}
	return o.APIUsername
}

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

func (o *SourceAkeneo) GetHost() string {
	if o == nil {
		return ""
	}
	return o.Host
}

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

func (o *SourceAkeneo) GetSecret() *string {
	if o == nil {
		return nil
	}
	return o.Secret
}

func (o *SourceAkeneo) GetSourceType() Akeneo {
	return AkeneoAkeneo
}
