package Common::DB::Item::MapFaceService;

use strict;
use warnings;

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

use constant kTable => 'mapface_service';
use constant kDB    => Common::DB::Item::kCommonDB;

sub Search {
    my ( $class, %args ) = @_;

    my $searchTerm = $args{searchTerm};
    my $limit      = $args{limit};

    my $where;

    if ($searchTerm) {
        $where = $class->SUPER::SearchSyntax( field => 'service_name', value => $searchTerm );
    }

    my $sql = 'SELECT * FROM ' . kTable;
    if ($where) {
        $sql .= " WHERE $where";
    }

    $sql .= ' ORDER BY service_name';

    if ($limit) {
        $sql .= " LIMIT $limit";
    }

    return $class->SUPER::GetAll($sql);
}

1;
