export type RestockStockType = 'good' | 'reject';

export type RestockItem = {
    id: number;
    product_variant_id: number;
    quantity: number;
    unit_price: number;
    subtotal: number;
    product_variant: {
        id: number;
        name: string;
        photo_url: string | null;
        photo_conversion_url: string | null;
        product: {
            id: number;
            name: string;
        };
    };
};

export type Restock = {
    id: number;
    created_by_id: number;
    total: number;
    notes: string | null;
    stock_type: RestockStockType;
    created_at: string;
    items_count: number;
    total_qty: number;
    product_names: string | null;
    photo_urls: string[];
    photo_conversion_urls: string[];
    created_by: {
        id: number;
        user_profile: {
            full_name: string;
        };
    };
    restock_items?: RestockItem[];
};

export type RestockForEdit = {
    id: number;
    stock_type: RestockStockType;
    notes: string | null;
    photo_key: string | null;
    photo_url: string | null;
    items: {
        id: number;
        product_variant_id: number;
        quantity: number;
        unit_price: number;
    }[];
};

export type ProductForRestock = {
    id: number;
    name: string;
    status: string;
    product_variants: {
        id: number;
        name: string;
        stock: number;
        reject_stock: number;
        photo_url: string | null;
        capital_price: number;
        reject_price: number;
    }[];
};

export type RestockCreateData = {
    products: ProductForRestock[];
};
