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

const (
	CopperCopper Copper = "copper"
)

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

type SourceCopper struct {
	// Copper API key
	APIKey string `json:"api_key"`
	// user email used to login in to Copper
	UserEmail  string `json:"user_email"`
	sourceType Copper `const:"copper" json:"sourceType"`
}

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

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

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

func (o *SourceCopper) GetUserEmail() string {
	if o == nil {
		return ""
	}
	return o.UserEmail
}

func (o *SourceCopper) GetSourceType() Copper {
	return CopperCopper
}
