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

type Webflow string

const (
	WebflowWebflow Webflow = "webflow"
)

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

type SourceWebflow struct {
	// The version of the Webflow API to use. See https://developers.webflow.com/#versioning
	AcceptVersion *string `json:"accept_version,omitempty"`
	// The API token for authenticating to Webflow. See https://university.webflow.com/lesson/intro-to-the-webflow-api
	APIKey string `json:"api_key"`
	// The id of the Webflow site you are requesting data from. See https://developers.webflow.com/#sites
	SiteID     string  `json:"site_id"`
	sourceType Webflow `const:"webflow" json:"sourceType"`
}

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

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

func (o *SourceWebflow) GetAcceptVersion() *string {
	if o == nil {
		return nil
	}
	return o.AcceptVersion
}

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

func (o *SourceWebflow) GetSiteID() string {
	if o == nil {
		return ""
	}
	return o.SiteID
}

func (o *SourceWebflow) GetSourceType() Webflow {
	return WebflowWebflow
}
