<?php
namespace factory;

/**
 * @deprecated Use \Domain\Crm\ClientRepository and \Controllers\CrmController instead.
 */
class Crm
{
  public static $source = [ 0 => 'ceidg', 1 => 'kontakt własny', 2 => 'BNI' ];
  public static $status = [ 0 => 'kontakt pozyskany', 1 => 'oferta wysłana', 2 => 'follow up', 3 => 'klient niezainteresowany' ];

  static public function settings()
  {
    $repository = new \Domain\Crm\ClientRepository();
    return $repository -> settings();
  }

  static public function get_client_name( int $client_id )
  {
    $repository = new \Domain\Crm\ClientRepository();
    return $repository -> getName( $client_id );
  }

  static public function get_client_list()
  {
    $repository = new \Domain\Crm\ClientRepository();
    return $repository -> all();
  }

  static public function client_delete( int $client_id )
  {
    $repository = new \Domain\Crm\ClientRepository();
    return $repository -> delete( $client_id );
  }

  public static function client_details( int $client_id )
  {
    $repository = new \Domain\Crm\ClientRepository();
    return $repository -> getById( $client_id );
  }

  public static function client_save( $client_id, $firm, $firm_name, $emails, $phones, $notes )
  {
    $repository = new \Domain\Crm\ClientRepository();
    return $repository -> save( (int)$client_id, $firm, $firm_name, $emails, $phones, $notes );
  }
}
