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

const (
	PostmarkappPostmarkapp Postmarkapp = "postmarkapp"
)

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

type SourcePostmarkapp struct {
	// API Key for account
	XPostmarkAccountToken string `json:"X-Postmark-Account-Token"`
	// API Key for server
	XPostmarkServerToken string      `json:"X-Postmark-Server-Token"`
	sourceType           Postmarkapp `const:"postmarkapp" json:"sourceType"`
}

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

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

func (o *SourcePostmarkapp) GetXPostmarkAccountToken() string {
	if o == nil {
		return ""
	}
	return o.XPostmarkAccountToken
}

func (o *SourcePostmarkapp) GetXPostmarkServerToken() string {
	if o == nil {
		return ""
	}
	return o.XPostmarkServerToken
}

func (o *SourcePostmarkapp) GetSourceType() Postmarkapp {
	return PostmarkappPostmarkapp
}
