<?
namespace admin\factory;

class ShopStatuses {
  // get_status
  public static function get_status( $id )
  {
    global $mdb;
    return $mdb -> get( 'pp_shop_statuses', '*', [ 'id' => $id ] );
  }

  // status_save
  public static function status_save( $status_id, $color, $apilo_status_id, $sellasi_status_id, $baselinker_status_id )
  {
    global $mdb;

    $mdb -> update( 'pp_shop_statuses', [
        'color' => $color,
        'apilo_status_id' => $apilo_status_id ? $apilo_status_id : null,
        'sellasist_status_id' => $sellasi_status_id ? $sellasi_status_id : null,
        'baselinker_status_id' => $baselinker_status_id ? $baselinker_status_id : null
      ], [ 'id' => $status_id ] );

    return $status_id;
  }
}