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

const (
	HuggingFaceDatasetsHuggingFaceDatasets HuggingFaceDatasets = "hugging-face-datasets"
)

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

type SourceHuggingFaceDatasets struct {
	DatasetName string `json:"dataset_name"`
	// Splits to import. Will import all of them if nothing is provided (see https://huggingface.co/docs/dataset-viewer/en/configs_and_splits for more details)
	DatasetSplits []any `json:"dataset_splits,omitempty"`
	// Dataset Subsets to import. Will import all of them if nothing is provided (see https://huggingface.co/docs/dataset-viewer/en/configs_and_splits for more details)
	DatasetSubsets []any               `json:"dataset_subsets,omitempty"`
	sourceType     HuggingFaceDatasets `const:"hugging-face-datasets" json:"sourceType"`
}

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

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

func (o *SourceHuggingFaceDatasets) GetDatasetName() string {
	if o == nil {
		return ""
	}
	return o.DatasetName
}

func (o *SourceHuggingFaceDatasets) GetDatasetSplits() []any {
	if o == nil {
		return nil
	}
	return o.DatasetSplits
}

func (o *SourceHuggingFaceDatasets) GetDatasetSubsets() []any {
	if o == nil {
		return nil
	}
	return o.DatasetSubsets
}

func (o *SourceHuggingFaceDatasets) GetSourceType() HuggingFaceDatasets {
	return HuggingFaceDatasetsHuggingFaceDatasets
}
