package models

import "time"

type OrderAddress struct {
	ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
	UserID uint `gorm:"column:userId;not null;index" json:"userId"`
	Name string `gorm:"column:name;type:varchar(255);not null" json:"name"`
	PhoneNumber string `gorm:"column:phoneNumber;type:varchar(20);not null" json:"phoneNumber"`
	PhoneNumber2 *string `gorm:"column:phoneNumber2;type:varchar(20)" json:"phoneNumber2"`
	FlatNo string `gorm:"column:flatNo;type:varchar(255);not null" json:"flatNo"`
	Locality string `gorm:"column:locality;type:varchar(255);not null" json:"locality"`
	Landmark *string `gorm:"column:landmark;type:varchar(255)" json:"landmark"`
	City string `gorm:"column:city;type:varchar(255);not null" json:"city"`
	State string `gorm:"column:state;type:varchar(255);not null" json:"state"`
	Country string `gorm:"column:country;type:varchar(255);not null" json:"country"`
	Pincode int `gorm:"column:pincode;not null" json:"pincode"`
	IsActive bool `gorm:"column:isActive;default:true" json:"isActive"`
	IsDelete bool `gorm:"column:isDelete;default:false" json:"isDelete"`
	CreatedAt *time.Time `gorm:"column:created_at" json:"created_at"`
	UpdatedAt *time.Time `gorm:"column:updated_at" json:"updated_at"`
	CreatedBy int `gorm:"column:createdBy;not null" json:"createdBy"`
	ModifiedBy int `gorm:"column:modifiedBy;not null" json:"modifiedBy"`
	CountryCode *string `gorm:"column:countryCode;type:varchar(45)" json:"countryCode"`
	AlternateCountryCode *string `gorm:"column:alternateCountryCode;type:varchar(45)" json:"alternateCountryCode"`
	// Relation
	User User `gorm:"foreignKey:UserID;references:ID" json:"user"`
}

func (OrderAddress) TableName() string {
	return "order_addresses"
}