package models import "time" // Ticket represents a support ticket type Ticket struct { ID int `json:"id" db:"id"` UserID *int `json:"userId,omitempty" db:"user_id"` CompanyID *int `json:"companyId,omitempty" db:"company_id"` Subject string `json:"subject" db:"subject"` Description string `json:"description" db:"description"` Category string `json:"category" db:"category"` Priority string `json:"priority" db:"priority"` Status string `json:"status" db:"status"` AssignedTo *int `json:"assignedTo,omitempty" db:"assigned_to"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` ResolvedAt *time.Time `json:"resolvedAt,omitempty" db:"resolved_at"` // Joined fields UserName *string `json:"userName,omitempty"` CompanyName *string `json:"companyName,omitempty"` AssigneeName *string `json:"assigneeName,omitempty"` } // TicketMessage represents a message within a ticket type TicketMessage struct { ID int `json:"id" db:"id"` TicketID int `json:"ticketId" db:"ticket_id"` UserID *int `json:"userId,omitempty" db:"user_id"` Message string `json:"message" db:"message"` IsInternal bool `json:"isInternal" db:"is_internal"` CreatedAt time.Time `json:"createdAt" db:"created_at"` // Joined fields UserName *string `json:"userName,omitempty"` } // CreateTicketRequest for creating a new ticket type CreateTicketRequest struct { Subject string `json:"subject"` Description string `json:"description"` Category string `json:"category"` Priority string `json:"priority"` } // UpdateTicketRequest for updating a ticket type UpdateTicketRequest struct { Status *string `json:"status,omitempty"` Priority *string `json:"priority,omitempty"` AssignedTo *int `json:"assignedTo,omitempty"` } // AddTicketMessageRequest for adding a message to a ticket type AddTicketMessageRequest struct { Message string `json:"message"` IsInternal bool `json:"isInternal"` } // TicketStats for dashboard type TicketStats struct { Total int `json:"total"` Open int `json:"open"` InProgress int `json:"inProgress"` Resolved int `json:"resolved"` AvgResponse float64 `json:"avgResponseTime"` // in hours }