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

const (
	PartnerizePartnerize Partnerize = "partnerize"
)

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

type SourcePartnerize struct {
	// The application key identifies the network you are making the request against. Find it in your account settings under 'User Application Key' at https://console.partnerize.com.
	ApplicationKey string `json:"application_key"`
	// The user API key identifies the user on whose behalf the request is made. Find it in your account settings under 'User API Key' at https://console.partnerize.com.
	UserAPIKey string     `json:"user_api_key"`
	sourceType Partnerize `const:"partnerize" json:"sourceType"`
}

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

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

func (o *SourcePartnerize) GetApplicationKey() string {
	if o == nil {
		return ""
	}
	return o.ApplicationKey
}

func (o *SourcePartnerize) GetUserAPIKey() string {
	if o == nil {
		return ""
	}
	return o.UserAPIKey
}

func (o *SourcePartnerize) GetSourceType() Partnerize {
	return PartnerizePartnerize
}
