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

const (
	DestinationConvexConvexConvex DestinationConvexConvex = "convex"
)

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

type DestinationConvex struct {
	// API access key used to send data to a Convex deployment.
	AccessKey string `json:"access_key"`
	// URL of the Convex deployment that is the destination
	DeploymentURL   string                  `json:"deployment_url"`
	destinationType DestinationConvexConvex `const:"convex" json:"destinationType"`
}

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

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

func (o *DestinationConvex) GetAccessKey() string {
	if o == nil {
		return ""
	}
	return o.AccessKey
}

func (o *DestinationConvex) GetDeploymentURL() string {
	if o == nil {
		return ""
	}
	return o.DeploymentURL
}

func (o *DestinationConvex) GetDestinationType() DestinationConvexConvex {
	return DestinationConvexConvexConvex
}
