package tickets

import (
	"time"
)

type Ticket struct {
	ID             int64      `json:"id"`
	TicketNumber   string     `json:"ticket_number"`
	Title          string     `json:"title"`
	Description    string     `json:"description"`
	Category       string     `json:"category"`
	Priority       string     `json:"priority"`
	Status         string     `json:"status"`
	SourceApp      string     `json:"source_app"`
	SourcePath     string     `json:"source_path"`
	ReporterID     int64      `json:"reporter_id"`
	ReporterName   string     `json:"reporter_name"`
	ReporterEmail  string     `json:"reporter_email"`
	AssignedToID   *int64     `json:"assigned_to_id"`
	AssignedToName string     `json:"assigned_to_name,omitempty"`
	Metadata       any        `json:"metadata"`
	CreatedAt      time.Time  `json:"created_at"`
	UpdatedAt      time.Time  `json:"updated_at"`
	ResolvedAt     *time.Time `json:"resolved_at,omitempty"`
}

type TicketComment struct {
	ID         int64     `json:"id"`
	TicketID   int64     `json:"ticket_id"`
	UserID     int64     `json:"user_id"`
	UserName   string    `json:"user_name"`
	Comment    string    `json:"comment"`
	IsInternal bool      `json:"is_internal"`
	CreatedAt  time.Time `json:"created_at"`
}

type CreateTicketRequest struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Category    string `json:"category"`
	Priority    string `json:"priority"`
	SourceApp   string `json:"source_app"`
	SourcePath  string `json:"source_path"`
	Metadata    any    `json:"metadata"`
}

type UpdateTicketRequest struct {
	Status       *string `json:"status"`
	Priority     *string `json:"priority"`
	AssignedToID *int64  `json:"assigned_to_id"`
}

type CreateCommentRequest struct {
	Comment    string `json:"comment"`
	IsInternal bool   `json:"is_internal"`
}

type ListTicketsFilter struct {
	Status     string
	Category   string
	Priority   string
	SourceApp  string
	ReporterID int64
	Search     string
	Limit      int
	Offset     int
}
