package store

import "time"

type Plan struct {
	ID               int
	Slug             string
	Name             string
	MaxActiveLeads   int
	MaxAddPerDay     *int
	MaxExportPerDay  int
	CanExport        bool
	PriceCents       int
	IsActive         bool
}

type User struct {
	ID           int64
	GlobalUserID *string
	Email        string
	Name         *string
	Role         string
	Status       string
	CreatedAt    time.Time
}

type Subscription struct {
	ID        int64
	UserID    int64
	PlanID    int
	Plan      *Plan
	Status    string
	StartsAt  time.Time
	EndsAt    *time.Time
}

type UserLead struct {
	ID             int64
	UserID         int64
	CNPJ           string
	Stage          string
	CompanyName    string
	City           string
	UF             string
	HasPhone       bool
	HasEmail       bool
	WorkedAt       time.Time
	StageChangedAt time.Time
	Notes          *string
}

type MessageTemplate struct {
	ID        int64
	UserID    int64
	Name      string
	Body      string
	IsDefault bool
}

type ExportJob struct {
	ID        int64
	UserID    int64
	LeadIDs   string
	RowCount  int
	CreatedAt time.Time
}

type DailyUsage struct {
	UserID       int64
	UsageDate    time.Time
	LeadsAdded   int
	ExportsCount int
}

type UserLimits struct {
	MaxActiveLeads   int
	ActiveLeadsCount int
	SlotsRemaining   int
	MaxAddPerDay     *int
	AddedToday       int
	CanExport        bool
	ExportsToday     int
	MaxExportPerDay  int
	CanUseApp        bool
	BlockReason      *string
}

const (
	StageNovos       = "novos"
	StageContatando  = "contatando"
	StageRespondeu   = "respondeu"
	StageNegociacao  = "negociacao"
	StageFechado     = "fechado"
	StagePerdido     = "perdido"
	StageArquivado   = "arquivado"
)

var TerminalStages = map[string]bool{
	StageFechado:   true,
	StagePerdido:   true,
	StageArquivado: true,
}

var AllStages = []string{
	StageNovos, StageContatando, StageRespondeu, StageNegociacao,
	StageFechado, StagePerdido, StageArquivado,
}
