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

const (
	VercelVercel Vercel = "vercel"
)

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

type SourceVercel struct {
	// Access token to authenticate with the Vercel API. Create and manage tokens in your Vercel account settings.
	AccessToken string    `json:"access_token"`
	StartDate   time.Time `json:"start_date"`
	sourceType  Vercel    `const:"vercel" json:"sourceType"`
}

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

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

func (o *SourceVercel) GetAccessToken() string {
	if o == nil {
		return ""
	}
	return o.AccessToken
}

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

func (o *SourceVercel) GetSourceType() Vercel {
	return VercelVercel
}
