<?php

// This module is not fully converted and implemented

include_once('SharePage.php');

class ModuleNetworkShare extends Module
{
  function __construct(System $System)
  {
    parent::__construct($System);
    $this->Name = 'NetworkShare';
    $this->Version = '1.0';
    $this->Creator = 'Chronos';
    $this->License = 'GNU/GPLv3';
    $this->Description = 'System for loading network computer share file list and allow fast searching.';
    $this->Dependencies = array(ModuleNetwork::GetName());
    $this->Models = array(NetworkShareItem::GetClassName(), NetworkShareError::GetClassName());
  }

  function DoStart(): void
  {
    $this->System->RegisterPage(['share'], 'SharePage');
  }
}

class NetworkShareItem extends Model
{
  static function GetModelDesc(): ModelDesc
  {
    $Desc = new ModelDesc('NetworkShareItem');
    $Desc->AddString('Name');
    $Desc->AddReference('Parent', NetworkShareItem::GetClassName());
    $Desc->AddReference('Host', NetworkDevice::GetClassName());
    $Desc->AddBigInt('Size');
    $Desc->AddString('Ext');
    $Desc->AddDate('Date');
    $Desc->AddInteger('Type');
    return $Desc;
  }
}

class NetworkShareError extends Model
{
  static function GetModelDesc(): ModelDesc
  {
    $Desc = new ModelDesc(self::GetClassName());
    $Desc->AddString('Host');
    $Desc->AddString('Message');
    return $Desc;
  }
}
