package models

import "time"

// Tenant represents the pre-existing 'tenants' table
type Tenant struct {
	Tenantid       int       `json:"tenantid" gorm:"primaryKey;column:tenantid"`
	Tenantname     string    `json:"tenantname" gorm:"column:tenantname"`
	Primaryemail   string    `json:"primaryemail" gorm:"column:primaryemail"`
	Primarycontact string    `json:"primarycontact" gorm:"column:primarycontact"`
	Status         string    `json:"status" gorm:"column:status;default:Active"`
	Createdat      time.Time `json:"createdat" gorm:"column:createdat;default:CURRENT_TIMESTAMP"`
	Updatedat      time.Time `json:"updatedat" gorm:"column:updatedat;default:CURRENT_TIMESTAMP"`
}

func (Tenant) TableName() string {
	return "tenants"
}

// Customer represents the pre-existing 'customers' table
type Customer struct {
	Customerid   int       `json:"customerid" gorm:"primaryKey;column:customerid"`
	Firstname    string    `json:"firstname" gorm:"column:firstname"`
	Lastname     string    `json:"lastname" gorm:"column:lastname"`
	Contactno    string    `json:"contactno" gorm:"column:contactno"`
	Email        string    `json:"email" gorm:"column:email"`
	Status       int       `json:"status" gorm:"column:status"`
	Createdat    time.Time `json:"createdat" gorm:"column:createdat"`
	Updatedat    time.Time `json:"updatedat" gorm:"column:updatedat"`
}

func (Customer) TableName() string {
	return "customers"
}

// CustomerLocation represents the pre-existing 'customerlocations' table
type CustomerLocation struct {
	Locationid int     `json:"locationid" gorm:"primaryKey;column:locationid"`
	Customerid int     `json:"customerid" gorm:"column:customerid"`
	Address    string  `json:"address" gorm:"column:address"`
	City       string  `json:"city" gorm:"column:city"`
	State      string  `json:"state" gorm:"column:state"`
	Postcode   string  `json:"postcode" gorm:"column:postcode"`
	Latitude   string  `json:"latitude" gorm:"column:latitude"`
	Longitude  string  `json:"longitude" gorm:"column:longitude"`
	Status     int     `json:"status" gorm:"column:status"`
}

func (CustomerLocation) TableName() string {
	return "customerlocations"
}

// AppLocation represents the pre-existing 'applocations' table
type AppLocation struct {
	Applocationid   int    `json:"applocationid" gorm:"primaryKey;column:applocationid"`
	Applocationname string `json:"applocationname" gorm:"column:applocationname"`
	Status          string `json:"status" gorm:"column:status"`
}

func (AppLocation) TableName() string {
	return "applocations"
}
