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

const (
	WordpressWordpress Wordpress = "wordpress"
)

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

type SourceWordpress struct {
	// The domain of the WordPress site. Example: my-wordpress-website.host.com
	Domain string `json:"domain"`
	// Placeholder for basic HTTP auth password - should be set to empty string
	Password *string `default:"x" json:"password"`
	// Minimal Date to Retrieve Records when stream allow incremental.
	StartDate time.Time `json:"start_date"`
	// Placeholder for basic HTTP auth username - should be set to empty string
	Username   *string   `default:"x" json:"username"`
	sourceType Wordpress `const:"wordpress" json:"sourceType"`
}

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

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

func (o *SourceWordpress) GetDomain() string {
	if o == nil {
		return ""
	}
	return o.Domain
}

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

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

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

func (o *SourceWordpress) GetSourceType() Wordpress {
	return WordpressWordpress
}
