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

const (
	CareQualityCommissionCareQualityCommission CareQualityCommission = "care-quality-commission"
)

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

type SourceCareQualityCommission struct {
	// Your CQC Primary Key. See https://www.cqc.org.uk/about-us/transparency/using-cqc-data#api for steps to generate one.
	APIKey     string                `json:"api_key"`
	sourceType CareQualityCommission `const:"care-quality-commission" json:"sourceType"`
}

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

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

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

func (o *SourceCareQualityCommission) GetSourceType() CareQualityCommission {
	return CareQualityCommissionCareQualityCommission
}
