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

const (
	PerigonPerigon Perigon = "perigon"
)

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

type SourcePerigon struct {
	// Your API key for authenticating with the Perigon API. Obtain it by creating an account at https://www.perigon.io/sign-up and verifying your email. The API key will be visible on your account dashboard.
	APIKey     string    `json:"api_key"`
	StartDate  time.Time `json:"start_date"`
	sourceType Perigon   `const:"perigon" json:"sourceType"`
}

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

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

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

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

func (o *SourcePerigon) GetSourceType() Perigon {
	return PerigonPerigon
}
