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

const (
	ImaggaImagga Imagga = "imagga"
)

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

type SourceImagga struct {
	// Your Imagga API key, available in your Imagga dashboard. Could be found at `https://imagga.com/profile/dashboard`
	APIKey string `json:"api_key"`
	// Your Imagga API secret, available in your Imagga dashboard. Could be found at `https://imagga.com/profile/dashboard`
	APISecret string `json:"api_secret"`
	// An image for detection endpoints
	ImgForDetection *string `default:"https://imagga.com/static/images/categorization/child-476506_640.jpg" json:"img_for_detection"`
	sourceType      Imagga  `const:"imagga" json:"sourceType"`
}

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

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

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

func (o *SourceImagga) GetAPISecret() string {
	if o == nil {
		return ""
	}
	return o.APISecret
}

func (o *SourceImagga) GetImgForDetection() *string {
	if o == nil {
		return nil
	}
	return o.ImgForDetection
}

func (o *SourceImagga) GetSourceType() Imagga {
	return ImaggaImagga
}
