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

const (
	OneHundredmsOneHundredms OneHundredms = "100ms"
)

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

type Source100ms struct {
	// The management token used for authenticating API requests. You can find or generate this token in your 100ms dashboard under the API section. Refer to the documentation at https://www.100ms.live/docs/concepts/v2/concepts/security-and-tokens#management-token-for-rest-api for more details.
	ManagementToken string       `json:"management_token"`
	StartDate       time.Time    `json:"start_date"`
	sourceType      OneHundredms `const:"100ms" json:"sourceType"`
}

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

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

func (o *Source100ms) GetManagementToken() string {
	if o == nil {
		return ""
	}
	return o.ManagementToken
}

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

func (o *Source100ms) GetSourceType() OneHundredms {
	return OneHundredmsOneHundredms
}
