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

// SourceConcordEnvironment - The environment from where you want to access the API.
type SourceConcordEnvironment string

const (
	SourceConcordEnvironmentUat SourceConcordEnvironment = "uat"
	SourceConcordEnvironmentAPI SourceConcordEnvironment = "api"
)

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

type Concord string

const (
	ConcordConcord Concord = "concord"
)

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

type SourceConcord struct {
	APIKey string `json:"api_key"`
	// The environment from where you want to access the API.
	Env        SourceConcordEnvironment `json:"env"`
	sourceType Concord                  `const:"concord" json:"sourceType"`
}

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

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

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

func (o *SourceConcord) GetEnv() SourceConcordEnvironment {
	if o == nil {
		return SourceConcordEnvironment("")
	}
	return o.Env
}

func (o *SourceConcord) GetSourceType() Concord {
	return ConcordConcord
}
