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

const (
	SftpJSONSftpJSON SftpJSON = "sftp-json"
)

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

type DestinationSftpJSON struct {
	// Path to the directory where json files will be written.
	DestinationPath string `json:"destination_path"`
	// Hostname of the SFTP server.
	Host string `json:"host"`
	// Password associated with the username.
	Password string `json:"password"`
	// Port of the SFTP server.
	Port *int64 `default:"22" json:"port"`
	// Username to use to access the SFTP server.
	Username        string   `json:"username"`
	destinationType SftpJSON `const:"sftp-json" json:"destinationType"`
}

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

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

func (o *DestinationSftpJSON) GetDestinationPath() string {
	if o == nil {
		return ""
	}
	return o.DestinationPath
}

func (o *DestinationSftpJSON) GetHost() string {
	if o == nil {
		return ""
	}
	return o.Host
}

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

func (o *DestinationSftpJSON) GetPort() *int64 {
	if o == nil {
		return nil
	}
	return o.Port
}

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

func (o *DestinationSftpJSON) GetDestinationType() SftpJSON {
	return SftpJSONSftpJSON
}
