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

const (
	EConomicEConomic EConomic = "e-conomic"
)

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

type SourceEConomic struct {
	// Token that identifies the grant issued by an agreement, allowing your app to access data. Obtain it from your e-conomic account settings.
	AgreementGrantToken string `json:"agreement_grant_token"`
	// Your private token that identifies your app. Find it in your e-conomic account settings.
	AppSecretToken string   `json:"app_secret_token"`
	sourceType     EConomic `const:"e-conomic" json:"sourceType"`
}

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

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

func (o *SourceEConomic) GetAgreementGrantToken() string {
	if o == nil {
		return ""
	}
	return o.AgreementGrantToken
}

func (o *SourceEConomic) GetAppSecretToken() string {
	if o == nil {
		return ""
	}
	return o.AppSecretToken
}

func (o *SourceEConomic) GetSourceType() EConomic {
	return EConomicEConomic
}
