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

const (
	XsollaXsolla Xsolla = "xsolla"
)

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

type SourceXsolla struct {
	// Go to Xsolla Dashboard and from company setting get the api_key
	APIKey string `json:"api_key"`
	// You can find this parameter in your Publisher Account next to the name of the project . Example: 44056
	ProjectID  float64 `json:"project_id"`
	sourceType Xsolla  `const:"xsolla" json:"sourceType"`
}

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

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

func (o *SourceXsolla) GetAPIKey() string {
	if o == nil {
		return ""
	}
	return o.APIKey
}

func (o *SourceXsolla) GetProjectID() float64 {
	if o == nil {
		return 0.0
	}
	return o.ProjectID
}

func (o *SourceXsolla) GetSourceType() Xsolla {
	return XsollaXsolla
}
