package Raptor::DB::Item::File;
use strict;
use warnings;

use lib '/app/tools/common/lib';
use Common::DB::Item;
use Common::Timer;
use base 'Common::DB::Item';

use constant kTable => 'file';
use constant kDB    => Common::DB::Item::kClientDB;

use constant kFileTypeLicenseIncome => 5;

use constant STATUS_NEW        => 1;
use constant STATUS_PROCESSING => 2;
use constant STATUS_INVALID    => 3;
use constant STATUS_OPEN       => 4;
use constant STATUS_CLOSED     => 5;
use constant STATUS_IN_QUEUE   => 6;
use constant STATUS_ON_HOLD    => 7;

sub GetByPeriodID {
    my ( $class, $periodID ) = @_;

    my $sql = "SELECT * FROM " . kTable . " WHERE period_id=$periodID";
    return $class->GetAll($sql);
}

sub GetAllOnHold {
    my ($class) = @_;

    my $sql = "SELECT * FROM " . kTable . " WHERE file_status = " . STATUS_ON_HOLD;
    return $class->GetAll($sql);
}

1;
