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

const (
	MailersendMailersend Mailersend = "mailersend"
)

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

type SourceMailersend struct {
	// Your API Token. See <a href="https://www.mailersend.com/help/managing-api-tokens">here</a>.
	APIToken string `json:"api_token"`
	// The domain entity in mailersend
	DomainID string `json:"domain_id"`
	// Timestamp is assumed to be UTC.
	StartDate  *float64   `json:"start_date,omitempty"`
	sourceType Mailersend `const:"mailersend" json:"sourceType"`
}

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

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

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

func (o *SourceMailersend) GetDomainID() string {
	if o == nil {
		return ""
	}
	return o.DomainID
}

func (o *SourceMailersend) GetStartDate() *float64 {
	if o == nil {
		return nil
	}
	return o.StartDate
}

func (o *SourceMailersend) GetSourceType() Mailersend {
	return MailersendMailersend
}
