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

const (
	OpenaqOpenaq Openaq = "openaq"
)

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

type SourceOpenaq struct {
	APIKey string `json:"api_key"`
	// The list of IDs of countries (comma separated) you need the data for, check more: https://docs.openaq.org/resources/countries
	CountryIds []any  `json:"country_ids"`
	sourceType Openaq `const:"openaq" json:"sourceType"`
}

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

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

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

func (o *SourceOpenaq) GetCountryIds() []any {
	if o == nil {
		return []any{}
	}
	return o.CountryIds
}

func (o *SourceOpenaq) GetSourceType() Openaq {
	return OpenaqOpenaq
}
