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

const (
	TeamworkTeamwork Teamwork = "teamwork"
)

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

type SourceTeamwork struct {
	Password *string `json:"password,omitempty"`
	// The teamwork site name appearing at the url
	SiteName   string    `json:"site_name"`
	StartDate  time.Time `json:"start_date"`
	Username   string    `json:"username"`
	sourceType Teamwork  `const:"teamwork" json:"sourceType"`
}

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

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

func (o *SourceTeamwork) GetPassword() *string {
	if o == nil {
		return nil
	}
	return o.Password
}

func (o *SourceTeamwork) GetSiteName() string {
	if o == nil {
		return ""
	}
	return o.SiteName
}

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

func (o *SourceTeamwork) GetUsername() string {
	if o == nil {
		return ""
	}
	return o.Username
}

func (o *SourceTeamwork) GetSourceType() Teamwork {
	return TeamworkTeamwork
}
