import type { Paginated, EnumOption as CommonEnumOption } from '@/types/common';
import type { MediaItem, MediaUploadState } from '@/types/media';

export type RawMaterialUnit = 'yard' | 'meter' | 'kilogram';

export type EnumOption = CommonEnumOption & {
    value: RawMaterialUnit;
};

export type RawMaterialPrice = {
    id: number;
    variant: string;
    stock: string;
    stock_formatted: string;
    price: number;
    price_formatted: string;
    price_input: string;
    stock_input: string;
    images?: MediaItem[];
};

export type RawMaterialListItem = {
    id: number;
    name: string;
    unit: RawMaterialUnit;
    unit_label: string;
    unit_abbreviation: string;
    total_stock_formatted?: string;
    total_inventory_value_formatted?: string;
    is_active: boolean;
    prices: RawMaterialPrice[];
    has_pending_request?: boolean;
    pending_request_id?: number;
    pending_request_action?: string;
    pending_request_action_label?: string;
    display_is_active?: boolean;
};

export type RawMaterialPriceFormItem = {
    client_id: string;
    id?: number;
    variant: string;
    price: string;
    stock: string;
    media: MediaUploadState;
};

export type RawMaterialFormData = {
    name: string;
    unit: RawMaterialUnit;
    prices: Array<{
        id?: number;
        variant: string;
        price: number;
        stock: number;
    }>;
};

export type PaginatedRawMaterials = Paginated<RawMaterialListItem>;
