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

const (
	FreightviewFreightview Freightview = "freightview"
)

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

type SourceFreightview struct {
	ClientID     string      `json:"client_id"`
	ClientSecret string      `json:"client_secret"`
	sourceType   Freightview `const:"freightview" json:"sourceType"`
}

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

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

func (o *SourceFreightview) GetClientID() string {
	if o == nil {
		return ""
	}
	return o.ClientID
}

func (o *SourceFreightview) GetClientSecret() string {
	if o == nil {
		return ""
	}
	return o.ClientSecret
}

func (o *SourceFreightview) GetSourceType() Freightview {
	return FreightviewFreightview
}
