import {colors} from "@material-tailwind/react/types/generic";

export interface ShipmentRequest {
    id: number;
    shipment_reference: string;
    note: string;
    user_id: number,
    delivery_address_name: string;
    delivery_address_company_name: string | null;
    delivery_address_street_name: string;
    delivery_address_street_number: string;
    delivery_address_city: string;
    delivery_address_zip: string;
    delivery_address_state_iso: string | null;
    delivery_address_country_iso: string;
    pickup_point_code: string | null;
    postnummer: string | null;
    contact_email: string;
    contact_telephone: string;
    cod_value: string | null;
    cod_variable_symbol: string | null;
    shipment_value: string;
    currency: string;
    weight: string;
    height: number;
    width: number;
    length: number;
    carrier: Carrier;
    package_type: string;
    created_at: Date;
    updated_at: Date;
    delivery_address: DeliveryAddress;
    shipment: Shipment;
    current_shipment_status: ShipmentStatusHistory;
    shipment_statuses: ShipmentStatusHistory[],
    user: User;
    batch: Batch;
    items: Item[];
    shipment_price: number;
}

export interface Item {
    id: number;
    shipment_request_id: number;
    name: string;
    item_note: string | null;
    model_number: string;
    HSCode: string;
    price: string;
    quantity: number;
    originCountry: string;
    weight: string;
    item_id_internal_warehouse: number;
    item_id_external: number;
    created_at: string;
    updated_at: string;
    imageUrl: string;
}

interface Shipment {
    id: number;
    user_id: number;
    shipment_request_id: number;
    internal_shipment_id: string;
    shipment_id: string;
    tracking_number: string;
    created_at: string;
    updated_at: string;
}

export interface ShipmentStatusHistory {
    id: number;
    shipment_status_id: number;
    shipment_id: number;
    status_note: string;
    shipment_status: ShipmentStatus;
}
export interface ShipmentStatus {
    id: number;
    name: string;
    description: string;
}

export interface DeliveryAddress {
    name: string;
    companyName: string | null;
    streetName: string;
    streetNumber: string;
    city: string;
    zip: string;
    stateISO: string | null;
    countryISO: string;
}

export interface Batch {
    carrier_master: CarrierMaster;
    id: number;
    user: User;
    item_count: number;
    error_count: number;
    created_at: string;
    updated_at: string;
    processed: boolean;
    printed: boolean;
    shipment_request: ShipmentRequest;
    latest_generated_file: File;
}
export interface Error {
    id: number;
    shipment_request_id: number;
    fetched: boolean;
    error_message: string;
    created_at: string;
    updated_at: string;
}

export interface ErrorObject {
    error: Error;
    shipment_request: ShipmentRequest;
    batch_id: number;
}

export interface CarrierMaster {
    id: number;
    display_name: string;
    shortname: string;
    img: string;
    api_url: string;
    api_url_sandbox: string;
    label_reprint: boolean;
    carrier_enabled: boolean;
    carriers: Carrier[]
}

export interface Carrier {
    id: number;
    internal: string;
    ext_id: string;
    carrier_name: string;
    carrier_shortname: string;
    pickup_points: boolean;
    carrier_contract: string; // Adjust the type if necessary
    customs_declarations: boolean; // Adjust the type if necessary
    cod_allowed: boolean;
    cod_enabled: boolean;
    cod_price: string; // Adjust the type if necessary
    country: string;
    zone_id: number;
    currency: string;
    img: string;
    enabled_store: boolean;
    shipping_price: string; // Adjust the type if necessary
    free_shipping_enabled: boolean;
    delivery_time: string; // Adjust the type if necessary
    display_order: number;
    api_allowed: boolean;
    carrier_master: CarrierMaster;
    base_pricing: CarrierBasePricing;
}

export interface AlertState {
    show: boolean;
    message: React.ReactNode;
    color: colors;
    pdfUrl: string;
    file_id: number;
    filename: string;
}

export interface UserDetails {
    user_id: number;
    apiCallbackURL: string | null;
    imageURL: string | null;
    callbacks_enabled: boolean;
    carrier_pricings?: UserCarrierPricing[]; // Adjusted to match model and JSON data
}

export interface User {
    id: number;
    name: string;
    email: string;
    details?: UserDetails;
}

export interface UserCarrierPricing {
    id: number;
    user_id: number;
    carrier_id: number;
    cod_price?: number;
    carrier?: Carrier; // Relationship to Carrier
    pricing_weights?: UserCarrierPricing2Weight[]; // Adjusted to match model and JSON data
    extra_fees?: UserCarrierPricingExtraFees[]; // Adjusted to match model and JSON data
}

export interface UserCarrierPricing2Weight {
    id: number;
    user_carrier_pricing_id: number;
    weight_max: number;
    shipping_price: number;
}

export interface UserCarrierPricingExtraFees {
    id: number;
    user_carrier_pricing_id: number;
    carrier_extra_fee_type_id: number;
    carrier_extra_fee_value: number;
    carrier_extra_fee_value_type: string; // Could be "monetary" or other types
    extra_fee_type?: CarrierExtraFeeTypes; // Relationship to CarrierExtraFeeTypes
}
export interface CarrierBasePricing {
    id: number;
    user_id: number;
    carrier_id: number;
    cod_price?: number;
    pricing_weights?: CarrierBasePricing2Weight[]; // Adjusted to match model and JSON data
    extra_fees?: CarrierBasePricingExtraFees[]; // Adjusted to match model and JSON data
}

export interface CarrierBasePricing2Weight {
    id: number;
    carrier_base_pricing_id: number;
    weight_max: number;
    shipping_price: number;
}

export interface CarrierBasePricingExtraFees {
    id: number;
    carrier_base_pricing_id: number;
    carrier_extra_fee_type_id: number;
    carrier_extra_fee_value: number;
    carrier_extra_fee_value_type: string; // Could be "monetary" or other types
    extra_fee_type?: CarrierExtraFeeTypes; // Relationship to CarrierExtraFeeTypes
}

export interface CarrierExtraFeeTypes {
    id: number;
    name: string;
    description?: string;
}


export interface PickupPoint {
    id: number;
    ext_id: string;
    carrier_id: number;
    carrier: Carrier;
    location: string;
    name: string;
    type: string;
    directions?: string;
    place_name?: string;
    address: string;
    zip: string;
    city: string;
    country_iso: string;
    status_id?: number;
    card?: boolean;
    cod?: boolean;
    wheelchair?: boolean;
    photo_url?: string;
    thumbnail_url?: string;
    enabled: boolean;
    distance: string;
    shipment_price: number;
    updated_at: Date;
}


export interface Files {
    files: File[]
}
export interface File {

    id: number;
    filename: string;
    user: User;
    // file_data: string;
    lifetime: string;
    associated_id: number;
    type: string;
    created_at: string;
    updated_at: string;

}


export interface StockList {
    to_be_withdrawn: number,
    name: string,
    model: string,
    physicalItemId: string,
    mapping_breakdown: MappingProduct[]
}

export interface MappingProduct {
    to_be_withdrawn: number,
    name: string,
    model: string,
    mapping_id: string,
    shipment_request_item_ids: number[]
}

export interface Task {
    id: number;
    user: User;
    task_title: string;
    task_desc: string;
    related_id: number;
    related_id_type: string;
    comment: string;
    completed: boolean;
}

