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

const (
	Cin7Cin7 Cin7 = "cin7"
)

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

type SourceCin7 struct {
	// The ID associated with your account.
	Accountid string `json:"accountid"`
	// The API key associated with your account.
	APIKey     string `json:"api_key"`
	sourceType Cin7   `const:"cin7" json:"sourceType"`
}

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

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

func (o *SourceCin7) GetAccountid() string {
	if o == nil {
		return ""
	}
	return o.Accountid
}

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

func (o *SourceCin7) GetSourceType() Cin7 {
	return Cin7Cin7
}
