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

const (
	HarnessHarness Harness = "harness"
)

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

type SourceHarness struct {
	// Harness Account ID
	AccountID string `json:"account_id"`
	APIKey    string `json:"api_key"`
	// The API URL for fetching data from Harness
	APIURL     *string `default:"https://app.harness.io" json:"api_url"`
	sourceType Harness `const:"harness" json:"sourceType"`
}

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

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

func (o *SourceHarness) GetAccountID() string {
	if o == nil {
		return ""
	}
	return o.AccountID
}

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

func (o *SourceHarness) GetAPIURL() *string {
	if o == nil {
		return nil
	}
	return o.APIURL
}

func (o *SourceHarness) GetSourceType() Harness {
	return HarnessHarness
}
