package com.quantumdigital.ithelp.timeanalyzer

import com.jdbernard.timeanalyzer.Category
import com.jdbernard.timeanalyzer.Event

public class TicketCategory extends Category {

    public final int ticketId

    public TicketCategory(int ticketId) {
        super()
        this.ticketId = ticketId
        this.description = "Ticket #${ticketId}"
    }

    public boolean matchesEvent(Event e) {
        return (e.description ==~ /ITHelp:.*#${ticketId}.*/)
    }

    public TicketEntry addEvent(Event e) {
        TicketEntry te = new TicketEntry(this, e)
        entries << te
        return te
    }
}
