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

const (
	EzofficeinventoryEzofficeinventory Ezofficeinventory = "ezofficeinventory"
)

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

type SourceEzofficeinventory struct {
	// Your EZOfficeInventory Access Token. API Access is disabled by default. Enable API Access in Settings > Integrations > API Integration and click on Update to generate a new access token
	APIKey string `json:"api_key"`
	// Earliest date you want to sync historical streams (inventory_histories, asset_histories, asset_stock_histories) from
	StartDate time.Time `json:"start_date"`
	// The company name used in signup, also visible in the URL when logged in.
	Subdomain  string            `json:"subdomain"`
	sourceType Ezofficeinventory `const:"ezofficeinventory" json:"sourceType"`
}

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

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

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

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

func (o *SourceEzofficeinventory) GetSubdomain() string {
	if o == nil {
		return ""
	}
	return o.Subdomain
}

func (o *SourceEzofficeinventory) GetSourceType() Ezofficeinventory {
	return EzofficeinventoryEzofficeinventory
}
