package slowquery

import (
	"time"
)

type ID uint64

type Base struct {
	ID        ID        `gorm:"primary_key;not null"`
	CreatedAt time.Time `gorm:"created_at;type:TIMESTAMP;not null;<-:create"` // create and read only
}

type Updatable struct {
	Base
	UpdatedAt *time.Time `gorm:"updated_at;type:TIMESTAMP"`
}

func (id ID) Uint64() uint64 {
	return uint64(id)
}

func (u Base) GetID() ID {
	return u.ID
}

type Tenant struct {
	Updatable

	Name             string `gorm:"type:VARCHAR(255);not null"`
	Email            string `gorm:"type:VARCHAR(255);uniqueIndex:idx_email;not null"`
	Country          string `gorm:"type:VARCHAR(255);not null"`
	TimeZone         string `gorm:"type:VARCHAR(255);not null"`
	Status           string `gorm:"type:ENUM('pending', 'active', 'inactive', 'deleted', 'cleared');not null"`
	Kind             string `gorm:"type:VARCHAR(64);default:'external'"`
	Plan             string `gorm:"type:VARCHAR(255);default:''"`
	Alias            string `gorm:"type:VARCHAR(255);default:''"`
	CountryRegion    string `gorm:"type:VARCHAR(255);default:''"`
	SalesOwnerEmail  string `gorm:"type:VARCHAR(255);default:''"`
	CustomID         string `gorm:"type:VARCHAR(255);default:''"`
	Segmentation     string `gorm:"type:VARCHAR(255);default:''"`
	SalesForceRegion string `gorm:"type:VARCHAR(255);default:''"`
	SalesForceKind   string `gorm:"type:VARCHAR(64);default:''"`
}
