// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.26.0

package order

import (
	"database/sql/driver"
	"fmt"

	"github.com/jackc/pgx/v5/pgtype"
	"github.com/shopspring/decimal"
)

type AddressDefaultType string

const (
	AddressDefaultTypeShipping AddressDefaultType = "Shipping"
	AddressDefaultTypeBilling  AddressDefaultType = "Billing"
)

func (e *AddressDefaultType) Scan(src interface{}) error {
	switch s := src.(type) {
	case []byte:
		*e = AddressDefaultType(s)
	case string:
		*e = AddressDefaultType(s)
	default:
		return fmt.Errorf("unsupported scan type for AddressDefaultType: %T", src)
	}
	return nil
}

type NullAddressDefaultType struct {
	AddressDefaultType AddressDefaultType
	Valid              bool // Valid is true if AddressDefaultType is not NULL
}

// Scan implements the Scanner interface.
func (ns *NullAddressDefaultType) Scan(value interface{}) error {
	if value == nil {
		ns.AddressDefaultType, ns.Valid = "", false
		return nil
	}
	ns.Valid = true
	return ns.AddressDefaultType.Scan(value)
}

// Value implements the driver Valuer interface.
func (ns NullAddressDefaultType) Value() (driver.Value, error) {
	if !ns.Valid {
		return nil, nil
	}
	return string(ns.AddressDefaultType), nil
}

type OrderStatus string

const (
	OrderStatusPending    OrderStatus = "Pending"
	OrderStatusProcessing OrderStatus = "Processing"
	OrderStatusShipped    OrderStatus = "Shipped"
	OrderStatusDelivered  OrderStatus = "Delivered"
	OrderStatusCancelled  OrderStatus = "Cancelled"
	OrderStatusFulfilled  OrderStatus = "Fulfilled"
)

func (e *OrderStatus) Scan(src interface{}) error {
	switch s := src.(type) {
	case []byte:
		*e = OrderStatus(s)
	case string:
		*e = OrderStatus(s)
	default:
		return fmt.Errorf("unsupported scan type for OrderStatus: %T", src)
	}
	return nil
}

type NullOrderStatus struct {
	OrderStatus OrderStatus
	Valid       bool // Valid is true if OrderStatus is not NULL
}

// Scan implements the Scanner interface.
func (ns *NullOrderStatus) Scan(value interface{}) error {
	if value == nil {
		ns.OrderStatus, ns.Valid = "", false
		return nil
	}
	ns.Valid = true
	return ns.OrderStatus.Scan(value)
}

// Value implements the driver Valuer interface.
func (ns NullOrderStatus) Value() (driver.Value, error) {
	if !ns.Valid {
		return nil, nil
	}
	return string(ns.OrderStatus), nil
}

type PaymentMethod string

const (
	PaymentMethodStripeCard      PaymentMethod = "StripeCard"
	PaymentMethodPaypal          PaymentMethod = "Paypal"
	PaymentMethodAnorInstallment PaymentMethod = "AnorInstallment"
	PaymentMethodPayOnDelivery   PaymentMethod = "PayOnDelivery"
)

func (e *PaymentMethod) Scan(src interface{}) error {
	switch s := src.(type) {
	case []byte:
		*e = PaymentMethod(s)
	case string:
		*e = PaymentMethod(s)
	default:
		return fmt.Errorf("unsupported scan type for PaymentMethod: %T", src)
	}
	return nil
}

type NullPaymentMethod struct {
	PaymentMethod PaymentMethod
	Valid         bool // Valid is true if PaymentMethod is not NULL
}

// Scan implements the Scanner interface.
func (ns *NullPaymentMethod) Scan(value interface{}) error {
	if value == nil {
		ns.PaymentMethod, ns.Valid = "", false
		return nil
	}
	ns.Valid = true
	return ns.PaymentMethod.Scan(value)
}

// Value implements the driver Valuer interface.
func (ns NullPaymentMethod) Value() (driver.Value, error) {
	if !ns.Valid {
		return nil, nil
	}
	return string(ns.PaymentMethod), nil
}

type PaymentStatus string

const (
	PaymentStatusPending PaymentStatus = "Pending"
	PaymentStatusPaid    PaymentStatus = "Paid"
)

func (e *PaymentStatus) Scan(src interface{}) error {
	switch s := src.(type) {
	case []byte:
		*e = PaymentStatus(s)
	case string:
		*e = PaymentStatus(s)
	default:
		return fmt.Errorf("unsupported scan type for PaymentStatus: %T", src)
	}
	return nil
}

type NullPaymentStatus struct {
	PaymentStatus PaymentStatus
	Valid         bool // Valid is true if PaymentStatus is not NULL
}

// Scan implements the Scanner interface.
func (ns *NullPaymentStatus) Scan(value interface{}) error {
	if value == nil {
		ns.PaymentStatus, ns.Valid = "", false
		return nil
	}
	ns.Valid = true
	return ns.PaymentStatus.Scan(value)
}

// Value implements the driver Valuer interface.
func (ns NullPaymentStatus) Value() (driver.Value, error) {
	if !ns.Valid {
		return nil, nil
	}
	return string(ns.PaymentStatus), nil
}

type Address struct {
	ID            int64
	UserID        int64
	DefaultFor    NullAddressDefaultType
	Name          string
	AddressLine1  string
	AddressLine2  *string
	City          string
	StateProvince *string
	PostalCode    *string
	Country       *string
	Phone         *string
	CreatedAt     pgtype.Timestamptz
	UpdatedAt     pgtype.Timestamptz
}

type Order struct {
	ID                int64
	UserID            int64
	CartID            int64
	PaymentMethod     PaymentMethod
	PaymentStatus     PaymentStatus
	Status            OrderStatus
	ShippingAddressID int64
	IsPickup          bool
	Amount            decimal.Decimal
	Currency          string
	CreatedAt         pgtype.Timestamptz
	UpdatedAt         pgtype.Timestamptz
}

type OrderItem struct {
	ID                int64
	OrderID           int64
	VariantID         int64
	Qty               int32
	Price             decimal.Decimal
	Thumbnail         string
	ProductName       string
	VariantAttributes []byte
	CreatedAt         pgtype.Timestamptz
	UpdatedAt         pgtype.Timestamptz
}

type StripeCardPayment struct {
	ID               int64
	OrderID          int64
	UserID           *int64
	BillingAddressID int64
	PaymentIntentID  string
	PaymentMethodID  *string
	Amount           decimal.Decimal
	Currency         string
	Status           string
	ClientSecret     *string
	LastError        *string
	CardLast4        string
	CardBrand        string
	CreatedAt        pgtype.Timestamptz
	UpdatedAt        pgtype.Timestamptz
}
