define([
    'Magento_Checkout/js/model/quote',
    'mage/translate',
    'Magento_Customer/js/customer-data'
], function (quote, $t, storage) {
    'use strict';

    var mixin = {
        validateShippingInformation: function () {
            var method = quote.shippingMethod();

            if (method && method.carrier_code === 'orlenpaczka') {
                var orlenData = storage.get('orlen-data')();

                if (!orlenData || !orlenData.destinationCode) {
                    this.errorValidationMessage(
                        $t('Please select an ORLEN Paczka pick-up point.')
                    );
                    return false;
                }
            }

            return this._super();
        }
    };

    return function (target) {
        return target.extend(mixin);
    };
});
