// 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"
	"time"
)

type Justcall string

const (
	JustcallJustcall Justcall = "justcall"
)

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

type SourceJustcall struct {
	APIKey2    string    `json:"api_key_2"`
	StartDate  time.Time `json:"start_date"`
	sourceType Justcall  `const:"justcall" json:"sourceType"`
}

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

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

func (o *SourceJustcall) GetAPIKey2() string {
	if o == nil {
		return ""
	}
	return o.APIKey2
}

func (o *SourceJustcall) GetStartDate() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.StartDate
}

func (o *SourceJustcall) GetSourceType() Justcall {
	return JustcallJustcall
}
