public function get_max_bit_num(string $id_user_option, string $id_parent = null, bool $incr = false): int
  {
    if ( 
      \bbn\str::is_uid($id_user_option) &&
      (\bbn\str::is_uid($id_parent) || is_null($id_parent)) &&
      ($cf = $this->get_class_cfg()) &&
      ($cfg =  $cf['arch']['user_options_bits'])
    ){
      if ( $max = $this->db->select_one([
        'table' => $cf['tables']['user_options_bits'], 
        'fields' => ["MAX($cfg[num])"],
        'where' => [
          'conditions' => [[
            'field' => $cfg['id_user_option'],
            'value' => $id_user_option
          ], [
            'field' => $cfg['id_parent'],
            empty($id_parent) ? 'operator' : 'value' => $id_parent ?: 'isnull'
          ]]
        ]
      ]) ){
        $max = (int)$max;
        return $incr ? $max+1 : $max;
      }
      return 0;
    }
  }