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

package address

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

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

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 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
}
