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

const (
	VismaEconomicVismaEconomic VismaEconomic = "visma-economic"
)

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

type SourceVismaEconomic struct {
	// Identifier for the grant issued by an agreement
	AgreementGrantToken string `json:"agreement_grant_token"`
	// Identification token for app accessing data
	AppSecretToken string        `json:"app_secret_token"`
	sourceType     VismaEconomic `const:"visma-economic" json:"sourceType"`
}

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

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

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

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

func (o *SourceVismaEconomic) GetSourceType() VismaEconomic {
	return VismaEconomicVismaEconomic
}
