<?php
/**
 * Query Helper Class
 *
 * @version     1.0.$Revision:$
 * @version     SVN: $Id:$
 * @package     bplan-base/globals
 * @subpackage  Helpers
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 * @copyright   Copyright (C) 2025 bplan-solutions GmbH & Co. KG <https://www.bplan-solutions.de/>
 * /Δ\
 */

namespace BplanBase\Globals\Helpers;


use BplanBase\Globals\Support\Query;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder as QueryBuilder;


/**
 * Query Helper Class
 *
 * @deprecated  User BplanBase\Globals\Support\Query instead
 *
 * @version     2.0.0 / 2025-07-25
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 */
class QueryHelper
{


/* +++ TRAITS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */


/* +++ CLASS CONSTANTS +++ ++++++++++++++++++++++++++++++++++++++++++++++++++ */


/* +++ OBJECT MEMBERS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++ */


/* +++ CLASS MEMBERS +++ ++++++++++++++++++++++++++++++++++++++++++++++++++++ */


/* +++ OBJECT METHODS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++ */


/* +++ CLASS METHODS +++ ++++++++++++++++++++++++++++++++++++++++++++++++++++ */


    /**
     *
     * @deprecated  User BplanBase\Globals\Support\Query::applyConditionsFromBuilder() instead
     *
     * @param       EloquentBuilder|QueryBuilder $FromQuery
     *
     * @param       EloquentBuilder $ToQuery
     *
     * @return      EloquentBuilder
     *
     * @version     1.0.0 / 2025-07-25
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public static function applyConditionsFromBuilder(EloquentBuilder|QueryBuilder $FromQuery, EloquentBuilder & $ToQuery): EloquentBuilder
    {
        return Query::applyConditionsFromBuilder($FromQuery, $ToQuery);

    } // applyConditionsFromBuilder()


    /**
     * Applies flexible orderBy instructions to the query.
     *
     * @deprecated  User BplanBase\Globals\Support\Query::applyOrderBy() instead
     *
     * @param       EloquentBuilder $Query
     *              The Eloquent query builder instance.
     *
     * @param       array|string|null $orderBy
     *              The ordering instructions.
     *              The $orderBy parameter can take several formats:
     *
     *              1. A single column name as a string:
     *                  'name'
     *
     *              2. An array of column names as strings (default direction: asc):
     *                  ['name', 'created_at']
     *
     *              3. An array of arrays with 'column' and optional 'direction':
     *                  [
     *                      ['column' => 'name'],
     *                      ['column' => 'created_at', 'direction' => 'desc']
     *                  ]
     *
     *              Mixed format is also supported:
     *                  [
     *                      'priority',
     *                      ['column' => 'created_at', 'direction' => 'desc']
     *                  ]
     *
     * @return      Builder
     *
     * @version     1.0.0 / 2025-05-25
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public static function applyOrderBy(EloquentBuilder $Query, array|string|null $orderBy): EloquentBuilder
    {
        return Query::applyOrderBy($Query, $orderBy);

    } // applyOrderBy()


} // class QueryHelper {}
