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

const (
	OpenDataDcOpenDataDc OpenDataDc = "open-data-dc"
)

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

type SourceOpenDataDc struct {
	APIKey string `json:"api_key"`
	// address or place or block
	Location *string `json:"location,omitempty"`
	// A unique identifier (Master Address Repository).
	Marid      *string    `json:"marid,omitempty"`
	sourceType OpenDataDc `const:"open-data-dc" json:"sourceType"`
}

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

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

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

func (o *SourceOpenDataDc) GetLocation() *string {
	if o == nil {
		return nil
	}
	return o.Location
}

func (o *SourceOpenDataDc) GetMarid() *string {
	if o == nil {
		return nil
	}
	return o.Marid
}

func (o *SourceOpenDataDc) GetSourceType() OpenDataDc {
	return OpenDataDcOpenDataDc
}
