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

const (
	TogglToggl Toggl = "toggl"
)

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

type SourceToggl struct {
	// Your API Token. See <a href="https://developers.track.toggl.com/docs/authentication">here</a>. The token is case sensitive.
	APIToken string `json:"api_token"`
	// To retrieve time entries created before the given date (inclusive).
	EndDate string `json:"end_date"`
	// Your organization id. See <a href="https://developers.track.toggl.com/docs/organization">here</a>.
	OrganizationID int64 `json:"organization_id"`
	// To retrieve time entries created after the given date (inclusive).
	StartDate string `json:"start_date"`
	// Your workspace id. See <a href="https://developers.track.toggl.com/docs/workspaces">here</a>.
	WorkspaceID int64 `json:"workspace_id"`
	sourceType  Toggl `const:"toggl" json:"sourceType"`
}

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

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

func (o *SourceToggl) GetAPIToken() string {
	if o == nil {
		return ""
	}
	return o.APIToken
}

func (o *SourceToggl) GetEndDate() string {
	if o == nil {
		return ""
	}
	return o.EndDate
}

func (o *SourceToggl) GetOrganizationID() int64 {
	if o == nil {
		return 0
	}
	return o.OrganizationID
}

func (o *SourceToggl) GetStartDate() string {
	if o == nil {
		return ""
	}
	return o.StartDate
}

func (o *SourceToggl) GetWorkspaceID() int64 {
	if o == nil {
		return 0
	}
	return o.WorkspaceID
}

func (o *SourceToggl) GetSourceType() Toggl {
	return TogglToggl
}
