// 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"
	"time"
)

// SourceRevolutMerchantUpdateEnvironment - The base url of your environment. Either sandbox or production
type SourceRevolutMerchantUpdateEnvironment string

const (
	SourceRevolutMerchantUpdateEnvironmentSandboxMerchant SourceRevolutMerchantUpdateEnvironment = "sandbox-merchant"
	SourceRevolutMerchantUpdateEnvironmentMerchant        SourceRevolutMerchantUpdateEnvironment = "merchant"
)

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

type SourceRevolutMerchantUpdate struct {
	// Specify the API version to use. This is required for certain API calls. Example: '2024-09-01'.
	APIVersion string `json:"api_version"`
	// The base url of your environment. Either sandbox or production
	Environment SourceRevolutMerchantUpdateEnvironment `json:"environment"`
	// Secret API key to use for authenticating with the Revolut Merchant API. Find it in your Revolut Business account under APIs > Merchant API.
	SecretAPIKey string    `json:"secret_api_key"`
	StartDate    time.Time `json:"start_date"`
}

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

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

func (o *SourceRevolutMerchantUpdate) GetAPIVersion() string {
	if o == nil {
		return ""
	}
	return o.APIVersion
}

func (o *SourceRevolutMerchantUpdate) GetEnvironment() SourceRevolutMerchantUpdateEnvironment {
	if o == nil {
		return SourceRevolutMerchantUpdateEnvironment("")
	}
	return o.Environment
}

func (o *SourceRevolutMerchantUpdate) GetSecretAPIKey() string {
	if o == nil {
		return ""
	}
	return o.SecretAPIKey
}

func (o *SourceRevolutMerchantUpdate) GetStartDate() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.StartDate
}
