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

type Shopwired string

const (
	ShopwiredShopwired Shopwired = "shopwired"
)

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

type SourceShopwired struct {
	// Your API Key, which acts as the username for Basic Authentication. You can find it in your ShopWired account under API settings.
	APIKey string `json:"api_key"`
	// Your API Secret, which acts as the password for Basic Authentication. You can find it in your ShopWired account under API settings.
	APISecret  string    `json:"api_secret"`
	StartDate  time.Time `json:"start_date"`
	sourceType Shopwired `const:"shopwired" json:"sourceType"`
}

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

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

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

func (o *SourceShopwired) GetAPISecret() string {
	if o == nil {
		return ""
	}
	return o.APISecret
}

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

func (o *SourceShopwired) GetSourceType() Shopwired {
	return ShopwiredShopwired
}
