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

const (
	CoassembleCoassemble Coassemble = "coassemble"
)

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

type SourceCoassemble struct {
	UserID     string     `json:"user_id"`
	UserToken  string     `json:"user_token"`
	sourceType Coassemble `const:"coassemble" json:"sourceType"`
}

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

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

func (o *SourceCoassemble) GetUserID() string {
	if o == nil {
		return ""
	}
	return o.UserID
}

func (o *SourceCoassemble) GetUserToken() string {
	if o == nil {
		return ""
	}
	return o.UserToken
}

func (o *SourceCoassemble) GetSourceType() Coassemble {
	return CoassembleCoassemble
}
