"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ManualShippingProvider = void 0;
const logger_1 = require("../../../config/logger");
class ManualShippingProvider {
    config;
    constructor(config) {
        this.config = config || {};
    }
    async authenticate() {
        return true;
    }
    async createShipment(details) {
        const mockShipmentId = `mnl_shp_${Date.now()}`;
        logger_1.logger.info(`[ManualShippingProvider] Created manual shipment: ${mockShipmentId}`);
        return {
            success: true,
            shipmentId: mockShipmentId,
            status: 'READY_TO_SHIP',
            estimatedDelivery: new Date(Date.now() + 4 * 24 * 60 * 60 * 1000), // 4 days out
        };
    }
    async generateAwb(shipmentId) {
        const mockAwb = `AWB-${Math.floor(100000000 + Math.random() * 900000000)}`;
        logger_1.logger.info(`[ManualShippingProvider] Generated AWB ${mockAwb} for shipment ${shipmentId}`);
        return {
            success: true,
            awbNumber: mockAwb,
            courierName: this.config.warehouseName || 'DTDC Standard Courier',
        };
    }
    async requestPickup(awbNumber, pickupTime) {
        const mockToken = `PKT-${Math.floor(100000 + Math.random() * 900000)}`;
        logger_1.logger.info(`[ManualShippingProvider] Pickup requested for AWB ${awbNumber} at ${pickupTime}`);
        return {
            success: true,
            pickupToken: mockToken,
            status: 'SCHEDULED',
        };
    }
    async cancelPickup(pickupToken) {
        logger_1.logger.info(`[ManualShippingProvider] Pickup cancelled for token: ${pickupToken}`);
        return true;
    }
    async generateLabel(shipmentId) {
        return {
            success: true,
            labelUrl: `https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf`,
        };
    }
    async generateInvoice(shipmentId) {
        return {
            success: true,
            invoiceUrl: `https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf`,
        };
    }
    async trackShipment(awbNumber) {
        return {
            success: true,
            awbNumber,
            status: 'TRANSIT',
            currentLocation: 'Hub Bengaluru',
            estimatedDelivery: new Date(Date.now() + 2 * 24 * 60 * 60 * 1000),
            timeline: [
                { status: 'ORDERED', eventDetails: 'Order Confirmed', eventTime: new Date(Date.now() - 24 * 3600000) },
                { status: 'PACKED', eventDetails: 'Package sealed at warehouse', eventTime: new Date(Date.now() - 18 * 3600000) },
                { status: 'READY_TO_SHIP', eventDetails: 'Manifest generated', eventTime: new Date(Date.now() - 12 * 3600000) },
                { status: 'PICKED_UP', eventDetails: 'Courier picked up package', eventTime: new Date(Date.now() - 6 * 3600000) },
                { status: 'TRANSIT', eventDetails: 'Arrived at sorting facility Bengaluru', eventTime: new Date() },
            ],
        };
    }
    async testConnection() {
        return {
            connected: true,
            message: 'Manual shipping provider connection mock tested successfully.',
        };
    }
}
exports.ManualShippingProvider = ManualShippingProvider;
//# sourceMappingURL=manual.provider.js.map