package performa.orm;

import oneit.logging.LoggingArea;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.utils.StringUtils;
import oneit.utils.filter.Filter;
import performa.orm.types.JobStatus;


public class Client extends BaseClient
{
    private static final long serialVersionUID = 0L;
    
    public  static LoggingArea  LOG = LoggingArea.createLoggingArea("Client");

    // This constructor should not be called
    public Client ()
    {
        // Do not add any code to this, always put it in initialiseNewObject
    }
    
    public int getApplicationCountByStatus(JobStatus jobStatus)
    {
        Filter<Job> filter  =   Job.SearchByAll().andJobStatus(new EqualsFilter<>(jobStatus));
        
        return pipelineClient().toJobs(filter).toJobApplications().uniqueVals().size();
    }

    
    @Override
    public String getToString() 
    {
        return StringUtils.subNulls(getClientName(), super.getToString());
    }
}