1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 
<?php

/* --------------------------------------------------------------
   OrderListGeneratorInterface.inc.php 2017-03-03
   Gambio GmbH
   http://www.gambio.de
   Copyright (c) 2017 Gambio GmbH
   Released under the GNU General Public License (Version 2)
   [http://www.gnu.org/licenses/gpl-2.0.html]
   --------------------------------------------------------------
*/

/**
 * Interface OrderListGeneratorInterface
 *
 * @category   System
 * @package    Order
 * @subpackage Interfaces
 */
interface OrderListGeneratorInterface
{
    /**
     * Get Order List Items
     *
     * Returns an order list item collection.
     *
     * @param string|array $conditions Provide a WHERE clause string or an associative array (actually any parameter
     *                                 that is acceptable by the "where" method of the CI_DB_query_builder method).
     * @param IntType      $startIndex The start index of the wanted array to be returned (default = null).
     * @param IntType      $maxCount   Maximum amount of items which should be returned (default = null).
     * @param StringType   $orderBy    A string which defines how the items should be ordered (default = null).
     *
     * @return OrderListItemCollection
     *
     * @throws InvalidArgumentException If the result rows contain invalid values.
     */
    public function getOrderListByConditions($conditions = [],
                                             IntType $startIndex = null,
                                             IntType $maxCount = null,
                                             StringType $orderBy = null);
    
    
    /**
     * Filters records by a single keyword string.
     *
     * @param StringType      $keyword    Keyword string to be used for searching in order records.
     * @param IntType|null    $startIndex The start index of the wanted array to be returned (default = null).
     * @param IntType|null    $maxCount   Maximum amount of items which should be returned (default = null).
     * @param StringType|null $orderBy    A string which defines how the items should be ordered (default = null).
     *
     * @return OrderListItemCollection Order list item collection.
     */
    public function getOrderListByKeyword(StringType $keyword,
                                          IntType $startIndex = null,
                                          IntType $maxCount = null,
                                          StringType $orderBy = null);
    
    
    /**
     * Get count of orders filtered by keyword
     *
     * @param StringType $keyword Keyword string to be used for searching in order records.
     *
     * @return int
     */
    public function getOrderListByKeywordCount(StringType $keyword);
    
    
    /**
     * Get the total count of all orders
     *
     * @return int
     */
    public function getOrderListCount();
    
    
    /**
     * Filter order list items by the provided parameters.
     *
     * The following slug names need to be used:
     *
     *   - number => orders.orders_id
     *   - customer => orders.customers_lastname orders.customers_firstname
     *   - group => orders.customers_status_name
     *   - sum => orders_total.value
     *   - payment => orders.payment_method
     *   - shipping => orders.shipping_method
     *   - countryIsoCode => orders.delivery_country_iso_code_2
     *   - date => orders.date_purchased
     *   - status => orders_status.orders_status_name
     *   - invoiceNumber => invoices.invoice_number
     *
     * @param array           $filterParameters Contains the column slug-names and their values.
     * @param IntType|null    $startIndex       The start index of the wanted array to be returned (default = null).
     * @param IntType|null    $maxCount         Maximum amount of items which should be returned (default = null).
     * @param StringType|null $orderBy          A string which defines how the items should be ordered (default = null).
     *
     * @return OrderListItemCollection
     */
    public function filterOrderList(array $filterParameters,
                                    IntType $startIndex = null,
                                    IntType $maxCount = null,
                                    StringType $orderBy = null);
    
    
    /**
     * Get the filtered orders count.
     *
     * This number is useful for pagination functionality where the app needs to know the number of the filtered rows.
     *
     * @param array $filterParameters
     *
     * @return int
     *
     * @throws BadMethodCallException
     */
    public function filterOrderListCount(array $filterParameters);
}