# Copyright 1999-2015. Parallels IP Holdings GmbH. All Rights Reserved.
package LegacyPanel::Entity;

use strict;
use warnings;

use Carp;

sub new($$) { confess "Redefine me!"; }

=pod

ID shoud be unique enough to distinguish entites of the particular kind.
ID may be provided by the source panel, crafted, etc.

=cut

sub _setId($$) {
  my ($self, $internalId) = @_;
  $self->{'_Id'} = $internalId;
}

sub getId($) {
  my ($self) = @_;
  return $self->{'_Id'};
}

=pod 

getChildrenIdList returns list of entity children (which are, in turn, entities) IDs. 

Assumptions: all children are of the same type.

=cut

sub getChildrenIdList($)   { confess "Redefine me!"; }
sub getChildType { die "redefine me!"; }
sub getEntityType { die "Redefine me!"; }

sub toString($) {
  my ($self) = @_;
  my $internalId = $self->getId();
  my $result = $self->getEntityType();
  if (defined($internalId)) {
    $result .= " '" . $internalId . "'";
  }
  return $result;
}

1;

