<?php
/**
 * NOTICE OF LICENSE.
 *
 * Copyright 2022 Kosmonaft.dev
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 *  @author    Alexandre DEBUSSCHÈRE <alexandre@kosmonaft.dev>
 *  @copyright 2022 - 2023 Kosmonaft.dev
 *  @license   MIT
 */

if (!defined('_PS_VERSION_')) {
    exit;
}

/**
 * Class MRMaxStat
 */
class MRMaxStat
{

    /**
     * @param int $code
     * @return string
     */
    public static function getMessageFromStat($code)
    {
        $stats = [];
        $stats[0] = 'Successfull operation';
        $stats[1] = 'Incorrect merchant';
        $stats[2] = 'Merchant number empty';
        $stats[3] = 'Incorrect merchant account number';
        $stats[4] = '';
        $stats[5] = 'Incorrect Merchant shipment reference';
        $stats[6] = '';
        $stats[7] = 'Incorrect Consignee reference';
        $stats[8] = 'Incorrect password or hash';
        $stats[9] = 'Unknown or not unique city';
        $stats[10] = 'Incorrect type of collection';
        $stats[11] = 'Point Relais collection number incorrect';
        $stats[12] = 'Point Relais collection country.incorrect';
        $stats[13] = 'Incorrect type of delivery';
        $stats[14] = 'Incorrect delivery Point Relais number';
        $stats[15] = 'Point Relais delivery country.incorrect';
        $stats[16] = '';
        $stats[17] = '';
        $stats[18] = '';
        $stats[19] = '';
        $stats[20] = 'Incorrect parcel weight';
        $stats[21] = 'Incorrect developped lenght (length + height)';
        $stats[22] = 'Incorrect parcel size';
        $stats[23] = '';
        $stats[24] = 'Incorrect shipment number';
        $stats[25] = 'Not enougth money on your acount to register this shipment';
        $stats[26] = 'Incorrect assembly time';
        $stats[27] = 'Incorrect mode of collection or delivery';
        $stats[28] = 'Incorrect mode of collection';
        $stats[29] = 'Incorrect mode of delivery';
        $stats[30] = 'Incorrect address (L1)';
        $stats[31] = 'Incorrect address (L2)';
        $stats[32] = '';
        $stats[33] = 'Incorrect address (L3)';
        $stats[34] = 'Incorrect address (L4)';
        $stats[35] = 'Incorrect city';
        $stats[36] = 'Incorrect zipcode';
        $stats[37] = 'Incorrect country';
        $stats[38] = 'Incorrect phone number';
        $stats[39] = 'Incorrect e-mail';
        $stats[40] = 'Missing parameters';
        $stats[41] = '';
        $stats[42] = 'Incorrect COD value';
        $stats[43] = 'Incorrect COD currency';
        $stats[44] = 'Incorrect shipment value';
        $stats[45] = 'Incorrect shipment value currency';
        $stats[46] = 'End of shipments number range reached';
        $stats[47] = 'Incorrect number of parcels';
        $stats[48] = 'Multi-Parcel not permitted at Point Relais�';
        $stats[49] = 'Incorrect action';
        $stats[50] = '';
        $stats[51] = '';
        $stats[52] = '';
        $stats[53] = '';
        $stats[54] = '';
        $stats[55] = '';
        $stats[56] = '';
        $stats[57] = '';
        $stats[58] = '';
        $stats[59] = '';
        $stats[60] = 'Incorrect text field (this error code has no impact)';
        $stats[61] = 'Incorrect notification request';
        $stats[62] = 'Incorrect extra delivery information';
        $stats[63] = 'Incorrect insurance';
        $stats[64] = 'Incorrect assembly time';
        $stats[65] = 'Incorrect appointement';
        $stats[66] = 'Incorrect take back';
        $stats[67] = 'Incorrect latitude';
        $stats[68] = 'Incorrect longitude';
        $stats[69] = 'Incorrect merchant code';
        $stats[70] = 'Incorrect Point Relais� number';
        $stats[71] = 'Incorrect Nature de point de vente non valide';
        $stats[72] = '';
        $stats[73] = '';
        $stats[74] = 'Incorrect language';
        $stats[75] = '';
        $stats[76] = '';
        $stats[77] = '';
        $stats[78] = 'Incorrect country of collection';
        $stats[79] = 'Incorrect country of delivery';
        $stats[80] = 'Tracking code : Recorded parcel';
        $stats[81] = 'Tracking code : Parcel in process at Mondial Relay';
        $stats[82] = 'Tracking code : Delivered parcel';
        $stats[83] = 'Tracking code : Anomaly';
        $stats[84] = '(Reserved tracking code)';
        $stats[85] = '(Reserved tracking code)';
        $stats[86] = '(Reserved tracking code)';
        $stats[87] = '(Reserved tracking code)';
        $stats[88] = '(Reserved tracking code)';
        $stats[89] = '(Reserved tracking code)';
        $stats[90] = '';
        $stats[91] = '';
        $stats[92] = 'Le code pays du destinataire et le code pays du Point Relais doivent être identiques'.
            ', ou, solde insuffisant (comptes prépayés)';
        $stats[93] = 'No information given by the sorting plan. '.
            'If you want to do a collection or delivery at Point Relais, please check it is avalaible. '.
            'If you want to do a home delivery, please check if the zipcode exists.';
        $stats[94] = 'Unknown parcel';
        $stats[95] = 'Merchant account not activated';
        $stats[96] = 'Type d\'enseigne incorrect en Base';
        $stats[97] = 'Incorrect security key';
        $stats[98] = 'Generic error (Incorrect parameters)';
        $stats[99] = 'Generic error of service system';


        $stats[1000] = 'An error occured while calling Dual Carrier API';

        return $stats[$code] ?: $code;
    }
}
