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

const (
	BigqueryBigquery Bigquery = "bigquery"
)

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

type SourceBigquery struct {
	// The contents of your Service Account Key JSON file. See the <a href="https://docs.airbyte.com/integrations/sources/bigquery#setup-the-bigquery-source-in-airbyte">docs</a> for more information on how to obtain this key.
	CredentialsJSON string `json:"credentials_json"`
	// The dataset ID to search for tables and views. If you are only loading data from one dataset, setting this option could result in much faster schema discovery.
	DatasetID *string `json:"dataset_id,omitempty"`
	// The GCP project ID for the project containing the target BigQuery dataset.
	ProjectID  string   `json:"project_id"`
	sourceType Bigquery `const:"bigquery" json:"sourceType"`
}

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

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

func (o *SourceBigquery) GetCredentialsJSON() string {
	if o == nil {
		return ""
	}
	return o.CredentialsJSON
}

func (o *SourceBigquery) GetDatasetID() *string {
	if o == nil {
		return nil
	}
	return o.DatasetID
}

func (o *SourceBigquery) GetProjectID() string {
	if o == nil {
		return ""
	}
	return o.ProjectID
}

func (o *SourceBigquery) GetSourceType() Bigquery {
	return BigqueryBigquery
}
