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

const (
	ShippoShippo Shippo = "shippo"
)

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

type SourceShippo struct {
	// The bearer token used for making requests
	ShippoToken string    `json:"shippo_token"`
	StartDate   time.Time `json:"start_date"`
	sourceType  Shippo    `const:"shippo" json:"sourceType"`
}

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

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

func (o *SourceShippo) GetShippoToken() string {
	if o == nil {
		return ""
	}
	return o.ShippoToken
}

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

func (o *SourceShippo) GetSourceType() Shippo {
	return ShippoShippo
}
