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

const (
	K6CloudK6Cloud K6Cloud = "k6-cloud"
)

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

type SourceK6Cloud struct {
	// Your API Token. See <a href="https://k6.io/docs/cloud/integrations/token/">here</a>. The key is case sensitive.
	APIToken   string  `json:"api_token"`
	sourceType K6Cloud `const:"k6-cloud" json:"sourceType"`
}

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

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

func (o *SourceK6Cloud) GetAPIToken() string {
	if o == nil {
		return ""
	}
	return o.APIToken
}

func (o *SourceK6Cloud) GetSourceType() K6Cloud {
	return K6CloudK6Cloud
}
