1 line
70 KiB
JSON
1 line
70 KiB
JSON
{"repo": "bt-rajan/jdkv2", "files": {"frontend/src/types/index.ts": {"504cd52753aaa6490b5f425b0aca204deac33a08": {"t": 1785745587.3856275, "n": 11764, "h": "5bba984f0a239902", "c": "// ── Auth ──────────────────────────────────────────────────────────────────\nexport interface TokenResponse {\n access_token: string;\n access_token_expires_at: number;\n refresh_token: string;\n}\n\nexport interface MeResponse {\n subject_id: string;\n email: string | null;\n full_name: string | null;\n department: string | null;\n roles: string[];\n permissions: string[];\n}\n\n// ── Users ─────────────────────────────────────────────────────────────────\nexport interface UserSummary {\n subject_id: string;\n email: string;\n full_name: string | null;\n phone: string | null;\n department: string | null;\n status: string;\n roles: string[];\n created_at: string;\n}\n\nexport interface AuditEntry {\n actor_subject_id: string;\n action: string;\n target_subject_id: string;\n previous_state: Record<string, unknown> | null;\n new_state: Record<string, unknown> | null;\n created_at: string;\n}\n\n// ── Employees (HR directory - distinct from Users/login above) ─────────────\nexport interface Employee {\n id: number;\n full_name: string;\n designation: string | null;\n phone: string | null;\n email: string | null;\n address: string | null;\n start_date: string | null;\n end_date: string | null;\n role: string | null;\n created_at: string;\n updated_at: string;\n}\n\n// ── Customers ─────────────────────────────────────────────────────────────\nexport interface OrderHistoryEntry {\n id: number;\n order_no: string;\n quantity_kg: number;\n delivery_date: string | null;\n status: string;\n priority: string;\n product_name: string;\n}\n\nexport interface Customer {\n id: number;\n name: string;\n client_type: string | null;\n contact_person: string | null;\n email: string | null;\n phone: string | null;\n delivery_address: string | null;\n billing_address: string | null;\n tax_id: string | null;\n payment_terms: string | null;\n credit_limit: number;\n status: string;\n notes: string | null;\n created_at: string;\n updated_at: string;\n orders?: OrderHistoryEntry[];\n}\n\n// ── Materials & Inventory ─────────────────────────────────────────────────\nexport interface ProductRef {\n id: number;\n name: string;\n}\n\nexport interface MovementEntry {\n id: number;\n movement_type: \"receipt\" | \"consumption\" | \"adjustment\";\n quantity: number;\n reference: string | null;\n received_date: string | null;\n invoice_id: string | null;\n invoice_amount: number | null;\n actor_subject_id: string | null;\n created_at: string;\n}\n\nexport interface Material {\n id: number;\n name: string;\n unit: string;\n shelf_life_days: number | null;\n default_supplier_id: number | null;\n status: string;\n current_stock: number;\n minimum_stock: number;\n reorder_point: number;\n lead_time_days: number;\n used_by_products?: ProductRef[];\n recent_movements?: MovementEntry[];\n}\n\n// ── Suppliers ─────────────────────────────────────────────────────────────\nexport interface MaterialSupplyTerm {\n id: number;\n material_id: number;\n material_name: string;\n unit: string;\n price: number;\n lead_time_days: number;\n minimum_order_qty: number;\n payment_terms: string | null;\n delivery_cost: number;\n}\n\nexport interface Supplier {\n id: number;\n name: string;\n contact_person: string | null;\n phone: string | null;\n email: string | null;\n address: string | null;\n tax_id: string | null;\n category: string | null;\n rating: number | null;\n status: string;\n notes: string | null;\n created_at: string;\n materials_supplied?: MaterialSupplyTerm[];\n}\n\n// ── Products & Formulas ───────────────────────────────────────────────────\nexport interface FormulaLine {\n material_id: number;\n material_name: string;\n unit: string;\n quantity_per_unit: number;\n}\n\nexport interface Formula {\n id: number;\n product_id: number;\n version: number;\n effective_from: string;\n is_active: boolean;\n created_at: string;\n lines: FormulaLine[];\n}\n\nexport interface FormulaVersionSummary {\n id: number;\n version: number;\n effective_from: string;\n is_active: boolean;\n created_at: string;\n}\n\nexport interface FinishedGoods {\n product_id: number;\n available_kg: number;\n available_bags: number;\n updated_at: string;\n}\n\nexport interface Product {\n id: number;\n name: string;\n category: string | null;\n unit_of_measure: string;\n default_bag_size_kg: number;\n status: string;\n created_at: string;\n active_formula?: Formula | null;\n formula_versions?: FormulaVersionSummary[];\n finished_goods?: FinishedGoods | null;\n}\n\n// ── Customer Orders ───────────────────────────────────────────────────────\nexport interface Availability {\n available_kg: number;\n required_kg: number;\n shortfall_kg: number;\n fulfillable_from_stock: boolean;\n}\n\nexport interface Order {\n id: number;\n order_no: string;\n chain_id: string | null;\n quotation_id: string | null;\n order_date: string | null;\n customer_id: number;\n customer_name: string;\n product_id: number;\n product_name: string;\n quantity_kg: number;\n bag_size_kg: number;\n bags: number;\n delivery_date: string | null;\n status: string;\n priority: \"critical\" | \"high\" | \"normal\" | \"low\";\n notes: string | null;\n created_at: string;\n updated_at: string;\n availability?: Availability;\n}\n\nexport const ORDER_STATUSES = [\n \"draft\", \"confirmed\", \"planned\", \"partially_fulfilled\",\n \"fulfilled\", \"at_risk\", \"delayed\", \"cancelled\",\n] as const;\n\n// ── Sales workflow: Feasibility -> Quotation -> Order -> Delivery ─────────\nexport interface FeasibilityConstraint {\n material_id: number | null;\n material_name: string | null;\n shortage: number | null;\n supplier_lead_time_days: number | null;\n}\n\nexport interface FeasibilityRun {\n id: string;\n chain_id: string;\n customer_id: number;\n customer_name: string;\n product_id: number;\n product_name: string;\n quantity_kg: number;\n requested_delivery_date: string;\n outcome: \"feasible\" | \"partially_feasible\" | \"feasible_on_later_date\" | \"at_risk\" | \"not_feasible\";\n estimated_fulfillment_date: string | null;\n promptly_available_kg: number;\n remaining_kg: number;\n constraints: FeasibilityConstraint[];\n status: \"open\" | \"converted\" | \"superseded\";\n notes: string | null;\n created_at: string;\n can_generate_quotation: boolean;\n}\n\nexport const FEASIBILITY_OUTCOMES = [\n \"feasible\", \"partially_feasible\", \"feasible_on_later_date\", \"at_risk\", \"not_feasible\",\n] as const;\n\nexport interface Quotation {\n id: string;\n chain_id: string;\n feasibility_id: string;\n quote_no: string;\n customer_id: number;\n customer_name: string;\n product_id: number;\n product_name: string;\n quantity_kg: number;\n unit_price: number;\n total_amount: number;\n quote_date: string;\n valid_until: string | null;\n requested_delivery_date: string;\n terms: string | null;\n notes: string | null;\n status: \"draft\" | \"sent\" | \"accepted\" | \"rejected\" | \"expired\" | \"converted\";\n created_at: string;\n updated_at: string;\n can_convert_to_order: boolean;\n}\n\nexport interface Delivery {\n id: string;\n chain_id: string;\n order_id: number;\n order_no: string;\n delivery_no: string;\n delivery_date: string;\n dispatched_qty_kg: number;\n carrier: string | null;\n tracking_ref: string | null;\n status: \"scheduled\" | \"dispatched\" | \"delivered\" | \"cancelled\";\n notes: string | null;\n created_at: string;\n updated_at: string;\n}\n\n// ── MRP / ATP ─────────────────────────────────────────────────────────────\nexport interface ContributingOrder {\n order_id: number;\n order_no: string;\n customer_name: string;\n quantity_kg: number;\n delivery_date: string | null;\n}\n\nexport interface ProductionRequirement {\n product_id: number;\n product_name: string;\n total_ordered_kg: number;\n finished_goods_kg: number;\n production_required_kg: number;\n has_active_formula: boolean;\n contributing_orders: ContributingOrder[];\n}\n\nexport interface SuggestedSupplier {\n supplier_id: number;\n supplier_name: string;\n price: number;\n lead_time_days: number;\n minimum_order_qty: number;\n is_projected: boolean;\n}\n\nexport interface MaterialRequirement {\n material_id: number;\n material_name: string;\n unit: string;\n gross_required: number;\n current_stock: number;\n net_required: number;\n shortage: boolean;\n affected_product_ids: number[];\n suggested_supplier: SuggestedSupplier | null;\n estimated_supply_date: string | null;\n}\n\nexport interface MrpSnapshot {\n production_requirements: ProductionRequirement[];\n material_requirements: MaterialRequirement[];\n has_shortages: boolean;\n}\n\nexport interface FeasibilityResult {\n order_id: number;\n order_no: string;\n outcome: \"feasible\" | \"partially_feasible\" | \"feasible_on_later_date\" | \"at_risk\" | \"not_feasible\";\n required_date: string | null;\n estimated_fulfillment_date: string;\n promptly_available_kg: number;\n remaining_kg: number;\n requested_kg: number;\n constraints: unknown[];\n}\n\n// ── Dashboard ─────────────────────────────────────────────────────────────\nexport interface DashboardSummary {\n open_order_count: number;\n products_with_open_demand: number;\n low_stock_material_count: number;\n low_stock_materials: Material[];\n material_shortage_count: number;\n top_material_shortages: MaterialRequirement[];\n orders_needing_attention_count: number;\n orders_needing_attention: FeasibilityResult[];\n}\n\n// ── Attachments ───────────────────────────────────────────────────────────\nexport interface Attachment {\n id: string;\n entity_type: string;\n entity_id: string;\n file_id: string;\n filename: string;\n label: string | null;\n uploaded_by_subject_id: string | null;\n created_at: string;\n}\n\n// ── Generic list envelope ─────────────────────────────────────────────────\nexport interface ListResponse<T> {\n total: number;\n [key: string]: T[] | number;\n}\n\n// ── Settings ──────────────────────────────────────────────────────────────\nexport interface AppSettings {\n deepseek_model: string;\n deepseek_base_url: string;\n deepseek_api_key_set: boolean;\n deepseek_api_key_preview: string | null;\n\n assistant_system_prompt: string;\n assistant_data_scope: string;\n\n batch_size_kg: number;\n daily_capacity_kg: number;\n planning_horizon_days: number;\n app_name: string;\n\n company_name: string;\n company_address: string;\n company_phone: string;\n company_email: string;\n company_tax_id: string;\n company_website: string;\n company_logo_attachment_id: string | null;\n}\n\nexport interface UpdateSettingsRequest {\n deepseek_api_key?: string;\n deepseek_model?: string;\n deepseek_base_url?: string;\n\n assistant_system_prompt?: string;\n assistant_data_scope?: string;\n\n batch_size_kg?: number;\n daily_capacity_kg?: number;\n planning_horizon_days?: number;\n app_name?: string;\n\n company_name?: string;\n company_address?: string;\n company_phone?: string;\n company_email?: string;\n company_tax_id?: string;\n company_website?: string;\n company_logo_attachment_id?: string;\n}\n\n// ── Production Cycle ──────────────────────────────────────────────────────\nexport interface RawMaterialRequirementLine {\n material_id: number;\n material_name: string;\n unit: string;\n quantity_per_batch: number;\n}\n\nexport interface ProductionCycle {\n product_id: number;\n batch_size: number;\n batch_size_unit: string;\n time_per_batch_minutes: number;\n finished_products_per_batch: number;\n output_per_batch: number;\n output_per_batch_unit: string;\n manpower_required: number;\n machinery_required: string;\n special_requirements: string | null;\n raw_material_requirements: RawMaterialRequirementLine[];\n has_active_formula: boolean;\n updated_at: string;\n}\n\nexport interface ProductionCycleUpsertRequest {\n batch_size: number;\n batch_size_unit: string;\n time_per_batch_minutes: number;\n finished_products_per_batch: number;\n output_per_batch: number;\n output_per_batch_unit: string;\n manpower_required: number;\n machinery_required: string;\n special_requirements: string | null;\n}\n"}, "8f2679c8ffe48b3a7de821b5564367b95934e1b1": {"t": 1785754541.6757147, "n": 11764, "h": "5bba984f0a239902", "c": "// ── Auth ──────────────────────────────────────────────────────────────────\nexport interface TokenResponse {\n access_token: string;\n access_token_expires_at: number;\n refresh_token: string;\n}\n\nexport interface MeResponse {\n subject_id: string;\n email: string | null;\n full_name: string | null;\n department: string | null;\n roles: string[];\n permissions: string[];\n}\n\n// ── Users ─────────────────────────────────────────────────────────────────\nexport interface UserSummary {\n subject_id: string;\n email: string;\n full_name: string | null;\n phone: string | null;\n department: string | null;\n status: string;\n roles: string[];\n created_at: string;\n}\n\nexport interface AuditEntry {\n actor_subject_id: string;\n action: string;\n target_subject_id: string;\n previous_state: Record<string, unknown> | null;\n new_state: Record<string, unknown> | null;\n created_at: string;\n}\n\n// ── Employees (HR directory - distinct from Users/login above) ─────────────\nexport interface Employee {\n id: number;\n full_name: string;\n designation: string | null;\n phone: string | null;\n email: string | null;\n address: string | null;\n start_date: string | null;\n end_date: string | null;\n role: string | null;\n created_at: string;\n updated_at: string;\n}\n\n// ── Customers ─────────────────────────────────────────────────────────────\nexport interface OrderHistoryEntry {\n id: number;\n order_no: string;\n quantity_kg: number;\n delivery_date: string | null;\n status: string;\n priority: string;\n product_name: string;\n}\n\nexport interface Customer {\n id: number;\n name: string;\n client_type: string | null;\n contact_person: string | null;\n email: string | null;\n phone: string | null;\n delivery_address: string | null;\n billing_address: string | null;\n tax_id: string | null;\n payment_terms: string | null;\n credit_limit: number;\n status: string;\n notes: string | null;\n created_at: string;\n updated_at: string;\n orders?: OrderHistoryEntry[];\n}\n\n// ── Materials & Inventory ─────────────────────────────────────────────────\nexport interface ProductRef {\n id: number;\n name: string;\n}\n\nexport interface MovementEntry {\n id: number;\n movement_type: \"receipt\" | \"consumption\" | \"adjustment\";\n quantity: number;\n reference: string | null;\n received_date: string | null;\n invoice_id: string | null;\n invoice_amount: number | null;\n actor_subject_id: string | null;\n created_at: string;\n}\n\nexport interface Material {\n id: number;\n name: string;\n unit: string;\n shelf_life_days: number | null;\n default_supplier_id: number | null;\n status: string;\n current_stock: number;\n minimum_stock: number;\n reorder_point: number;\n lead_time_days: number;\n used_by_products?: ProductRef[];\n recent_movements?: MovementEntry[];\n}\n\n// ── Suppliers ─────────────────────────────────────────────────────────────\nexport interface MaterialSupplyTerm {\n id: number;\n material_id: number;\n material_name: string;\n unit: string;\n price: number;\n lead_time_days: number;\n minimum_order_qty: number;\n payment_terms: string | null;\n delivery_cost: number;\n}\n\nexport interface Supplier {\n id: number;\n name: string;\n contact_person: string | null;\n phone: string | null;\n email: string | null;\n address: string | null;\n tax_id: string | null;\n category: string | null;\n rating: number | null;\n status: string;\n notes: string | null;\n created_at: string;\n materials_supplied?: MaterialSupplyTerm[];\n}\n\n// ── Products & Formulas ───────────────────────────────────────────────────\nexport interface FormulaLine {\n material_id: number;\n material_name: string;\n unit: string;\n quantity_per_unit: number;\n}\n\nexport interface Formula {\n id: number;\n product_id: number;\n version: number;\n effective_from: string;\n is_active: boolean;\n created_at: string;\n lines: FormulaLine[];\n}\n\nexport interface FormulaVersionSummary {\n id: number;\n version: number;\n effective_from: string;\n is_active: boolean;\n created_at: string;\n}\n\nexport interface FinishedGoods {\n product_id: number;\n available_kg: number;\n available_bags: number;\n updated_at: string;\n}\n\nexport interface Product {\n id: number;\n name: string;\n category: string | null;\n unit_of_measure: string;\n default_bag_size_kg: number;\n status: string;\n created_at: string;\n active_formula?: Formula | null;\n formula_versions?: FormulaVersionSummary[];\n finished_goods?: FinishedGoods | null;\n}\n\n// ── Customer Orders ───────────────────────────────────────────────────────\nexport interface Availability {\n available_kg: number;\n required_kg: number;\n shortfall_kg: number;\n fulfillable_from_stock: boolean;\n}\n\nexport interface Order {\n id: number;\n order_no: string;\n chain_id: string | null;\n quotation_id: string | null;\n order_date: string | null;\n customer_id: number;\n customer_name: string;\n product_id: number;\n product_name: string;\n quantity_kg: number;\n bag_size_kg: number;\n bags: number;\n delivery_date: string | null;\n status: string;\n priority: \"critical\" | \"high\" | \"normal\" | \"low\";\n notes: string | null;\n created_at: string;\n updated_at: string;\n availability?: Availability;\n}\n\nexport const ORDER_STATUSES = [\n \"draft\", \"confirmed\", \"planned\", \"partially_fulfilled\",\n \"fulfilled\", \"at_risk\", \"delayed\", \"cancelled\",\n] as const;\n\n// ── Sales workflow: Feasibility -> Quotation -> Order -> Delivery ─────────\nexport interface FeasibilityConstraint {\n material_id: number | null;\n material_name: string | null;\n shortage: number | null;\n supplier_lead_time_days: number | null;\n}\n\nexport interface FeasibilityRun {\n id: string;\n chain_id: string;\n customer_id: number;\n customer_name: string;\n product_id: number;\n product_name: string;\n quantity_kg: number;\n requested_delivery_date: string;\n outcome: \"feasible\" | \"partially_feasible\" | \"feasible_on_later_date\" | \"at_risk\" | \"not_feasible\";\n estimated_fulfillment_date: string | null;\n promptly_available_kg: number;\n remaining_kg: number;\n constraints: FeasibilityConstraint[];\n status: \"open\" | \"converted\" | \"superseded\";\n notes: string | null;\n created_at: string;\n can_generate_quotation: boolean;\n}\n\nexport const FEASIBILITY_OUTCOMES = [\n \"feasible\", \"partially_feasible\", \"feasible_on_later_date\", \"at_risk\", \"not_feasible\",\n] as const;\n\nexport interface Quotation {\n id: string;\n chain_id: string;\n feasibility_id: string;\n quote_no: string;\n customer_id: number;\n customer_name: string;\n product_id: number;\n product_name: string;\n quantity_kg: number;\n unit_price: number;\n total_amount: number;\n quote_date: string;\n valid_until: string | null;\n requested_delivery_date: string;\n terms: string | null;\n notes: string | null;\n status: \"draft\" | \"sent\" | \"accepted\" | \"rejected\" | \"expired\" | \"converted\";\n created_at: string;\n updated_at: string;\n can_convert_to_order: boolean;\n}\n\nexport interface Delivery {\n id: string;\n chain_id: string;\n order_id: number;\n order_no: string;\n delivery_no: string;\n delivery_date: string;\n dispatched_qty_kg: number;\n carrier: string | null;\n tracking_ref: string | null;\n status: \"scheduled\" | \"dispatched\" | \"delivered\" | \"cancelled\";\n notes: string | null;\n created_at: string;\n updated_at: string;\n}\n\n// ── MRP / ATP ─────────────────────────────────────────────────────────────\nexport interface ContributingOrder {\n order_id: number;\n order_no: string;\n customer_name: string;\n quantity_kg: number;\n delivery_date: string | null;\n}\n\nexport interface ProductionRequirement {\n product_id: number;\n product_name: string;\n total_ordered_kg: number;\n finished_goods_kg: number;\n production_required_kg: number;\n has_active_formula: boolean;\n contributing_orders: ContributingOrder[];\n}\n\nexport interface SuggestedSupplier {\n supplier_id: number;\n supplier_name: string;\n price: number;\n lead_time_days: number;\n minimum_order_qty: number;\n is_projected: boolean;\n}\n\nexport interface MaterialRequirement {\n material_id: number;\n material_name: string;\n unit: string;\n gross_required: number;\n current_stock: number;\n net_required: number;\n shortage: boolean;\n affected_product_ids: number[];\n suggested_supplier: SuggestedSupplier | null;\n estimated_supply_date: string | null;\n}\n\nexport interface MrpSnapshot {\n production_requirements: ProductionRequirement[];\n material_requirements: MaterialRequirement[];\n has_shortages: boolean;\n}\n\nexport interface FeasibilityResult {\n order_id: number;\n order_no: string;\n outcome: \"feasible\" | \"partially_feasible\" | \"feasible_on_later_date\" | \"at_risk\" | \"not_feasible\";\n required_date: string | null;\n estimated_fulfillment_date: string;\n promptly_available_kg: number;\n remaining_kg: number;\n requested_kg: number;\n constraints: unknown[];\n}\n\n// ── Dashboard ─────────────────────────────────────────────────────────────\nexport interface DashboardSummary {\n open_order_count: number;\n products_with_open_demand: number;\n low_stock_material_count: number;\n low_stock_materials: Material[];\n material_shortage_count: number;\n top_material_shortages: MaterialRequirement[];\n orders_needing_attention_count: number;\n orders_needing_attention: FeasibilityResult[];\n}\n\n// ── Attachments ───────────────────────────────────────────────────────────\nexport interface Attachment {\n id: string;\n entity_type: string;\n entity_id: string;\n file_id: string;\n filename: string;\n label: string | null;\n uploaded_by_subject_id: string | null;\n created_at: string;\n}\n\n// ── Generic list envelope ─────────────────────────────────────────────────\nexport interface ListResponse<T> {\n total: number;\n [key: string]: T[] | number;\n}\n\n// ── Settings ──────────────────────────────────────────────────────────────\nexport interface AppSettings {\n deepseek_model: string;\n deepseek_base_url: string;\n deepseek_api_key_set: boolean;\n deepseek_api_key_preview: string | null;\n\n assistant_system_prompt: string;\n assistant_data_scope: string;\n\n batch_size_kg: number;\n daily_capacity_kg: number;\n planning_horizon_days: number;\n app_name: string;\n\n company_name: string;\n company_address: string;\n company_phone: string;\n company_email: string;\n company_tax_id: string;\n company_website: string;\n company_logo_attachment_id: string | null;\n}\n\nexport interface UpdateSettingsRequest {\n deepseek_api_key?: string;\n deepseek_model?: string;\n deepseek_base_url?: string;\n\n assistant_system_prompt?: string;\n assistant_data_scope?: string;\n\n batch_size_kg?: number;\n daily_capacity_kg?: number;\n planning_horizon_days?: number;\n app_name?: string;\n\n company_name?: string;\n company_address?: string;\n company_phone?: string;\n company_email?: string;\n company_tax_id?: string;\n company_website?: string;\n company_logo_attachment_id?: string;\n}\n\n// ── Production Cycle ──────────────────────────────────────────────────────\nexport interface RawMaterialRequirementLine {\n material_id: number;\n material_name: string;\n unit: string;\n quantity_per_batch: number;\n}\n\nexport interface ProductionCycle {\n product_id: number;\n batch_size: number;\n batch_size_unit: string;\n time_per_batch_minutes: number;\n finished_products_per_batch: number;\n output_per_batch: number;\n output_per_batch_unit: string;\n manpower_required: number;\n machinery_required: string;\n special_requirements: string | null;\n raw_material_requirements: RawMaterialRequirementLine[];\n has_active_formula: boolean;\n updated_at: string;\n}\n\nexport interface ProductionCycleUpsertRequest {\n batch_size: number;\n batch_size_unit: string;\n time_per_batch_minutes: number;\n finished_products_per_batch: number;\n output_per_batch: number;\n output_per_batch_unit: string;\n manpower_required: number;\n machinery_required: string;\n special_requirements: string | null;\n}\n"}, "0442c6bda7afd978d2dc15326e147332dd2a39fc": {"t": 1785754543.1687193, "n": 11185, "h": "b4f8c213db712de3", "c": "// ── Auth ──────────────────────────────────────────────────────────────────\nexport interface TokenResponse {\n access_token: string;\n access_token_expires_at: number;\n refresh_token: string;\n}\n\nexport interface MeResponse {\n subject_id: string;\n email: string | null;\n full_name: string | null;\n department: string | null;\n roles: string[];\n permissions: string[];\n}\n\n// ── Users ─────────────────────────────────────────────────────────────────\nexport interface UserSummary {\n subject_id: string;\n email: string;\n full_name: string | null;\n phone: string | null;\n department: string | null;\n status: string;\n roles: string[];\n created_at: string;\n}\n\nexport interface AuditEntry {\n actor_subject_id: string;\n action: string;\n target_subject_id: string;\n previous_state: Record<string, unknown> | null;\n new_state: Record<string, unknown> | null;\n created_at: string;\n}\n\n// ── Customers ─────────────────────────────────────────────────────────────\nexport interface OrderHistoryEntry {\n id: number;\n order_no: string;\n quantity_kg: number;\n delivery_date: string | null;\n status: string;\n priority: string;\n product_name: string;\n}\n\nexport interface Customer {\n id: number;\n name: string;\n contact_person: string | null;\n email: string | null;\n phone: string | null;\n address: string | null;\n billing_address: string | null;\n gstin: string | null;\n payment_terms: string | null;\n credit_limit: number;\n status: string;\n notes: string | null;\n created_at: string;\n updated_at: string;\n orders?: OrderHistoryEntry[];\n}\n\n// ── Materials & Inventory ─────────────────────────────────────────────────\nexport interface ProductRef {\n id: number;\n name: string;\n}\n\nexport interface MovementEntry {\n id: number;\n movement_type: \"receipt\" | \"consumption\" | \"adjustment\";\n quantity: number;\n reference: string | null;\n actor_subject_id: string | null;\n created_at: string;\n}\n\nexport interface Material {\n id: number;\n name: string;\n unit: string;\n status: string;\n current_stock: number;\n minimum_stock: number;\n reorder_point: number;\n lead_time_days: number;\n used_by_products?: ProductRef[];\n recent_movements?: MovementEntry[];\n}\n\n// ── Suppliers ─────────────────────────────────────────────────────────────\nexport interface MaterialSupplyTerm {\n id: number;\n material_id: number;\n material_name: string;\n unit: string;\n price: number;\n lead_time_days: number;\n minimum_order_qty: number;\n payment_terms: string | null;\n delivery_cost: number;\n}\n\nexport interface Supplier {\n id: number;\n name: string;\n contact_person: string | null;\n phone: string | null;\n email: string | null;\n address: string | null;\n gstin: string | null;\n category: string | null;\n rating: number | null;\n status: string;\n notes: string | null;\n created_at: string;\n materials_supplied?: MaterialSupplyTerm[];\n}\n\n// ── Products & Formulas ───────────────────────────────────────────────────\nexport interface FormulaLine {\n material_id: number;\n material_name: string;\n unit: string;\n quantity_per_unit: number;\n}\n\nexport interface Formula {\n id: number;\n product_id: number;\n version: number;\n effective_from: string;\n is_active: boolean;\n created_at: string;\n lines: FormulaLine[];\n}\n\nexport interface FormulaVersionSummary {\n id: number;\n version: number;\n effective_from: string;\n is_active: boolean;\n created_at: string;\n}\n\nexport interface FinishedGoods {\n product_id: number;\n available_kg: number;\n available_bags: number;\n updated_at: string;\n}\n\nexport interface Product {\n id: number;\n name: string;\n category: string | null;\n unit_of_measure: string;\n default_bag_size_kg: number;\n status: string;\n created_at: string;\n active_formula?: Formula | null;\n formula_versions?: FormulaVersionSummary[];\n finished_goods?: FinishedGoods | null;\n}\n\n// ── Customer Orders ───────────────────────────────────────────────────────\nexport interface Availability {\n available_kg: number;\n required_kg: number;\n shortfall_kg: number;\n fulfillable_from_stock: boolean;\n}\n\nexport interface Order {\n id: number;\n order_no: string;\n chain_id: string | null;\n quotation_id: string | null;\n order_date: string | null;\n customer_id: number;\n customer_name: string;\n product_id: number;\n product_name: string;\n quantity_kg: number;\n bag_size_kg: number;\n bags: number;\n delivery_date: string | null;\n status: string;\n priority: \"critical\" | \"high\" | \"normal\" | \"low\";\n notes: string | null;\n created_at: string;\n updated_at: string;\n availability?: Availability;\n}\n\nexport const ORDER_STATUSES = [\n \"draft\", \"confirmed\", \"planned\", \"partially_fulfilled\",\n \"fulfilled\", \"at_risk\", \"delayed\", \"cancelled\",\n] as const;\n\n// ── Sales workflow: Feasibility -> Quotation -> Order -> Delivery ─────────\nexport interface FeasibilityConstraint {\n material_id: number | null;\n material_name: string | null;\n shortage: number | null;\n supplier_lead_time_days: number | null;\n}\n\nexport interface FeasibilityRun {\n id: string;\n chain_id: string;\n customer_id: number;\n customer_name: string;\n product_id: number;\n product_name: string;\n quantity_kg: number;\n requested_delivery_date: string;\n outcome: \"feasible\" | \"partially_feasible\" | \"feasible_on_later_date\" | \"at_risk\" | \"not_feasible\";\n estimated_fulfillment_date: string | null;\n promptly_available_kg: number;\n remaining_kg: number;\n constraints: FeasibilityConstraint[];\n status: \"open\" | \"converted\" | \"superseded\";\n notes: string | null;\n created_at: string;\n can_generate_quotation: boolean;\n}\n\nexport const FEASIBILITY_OUTCOMES = [\n \"feasible\", \"partially_feasible\", \"feasible_on_later_date\", \"at_risk\", \"not_feasible\",\n] as const;\n\nexport interface Quotation {\n id: string;\n chain_id: string;\n feasibility_id: string;\n quote_no: string;\n customer_id: number;\n customer_name: string;\n product_id: number;\n product_name: string;\n quantity_kg: number;\n unit_price: number;\n total_amount: number;\n quote_date: string;\n valid_until: string | null;\n requested_delivery_date: string;\n terms: string | null;\n notes: string | null;\n status: \"draft\" | \"sent\" | \"accepted\" | \"rejected\" | \"expired\" | \"converted\";\n created_at: string;\n updated_at: string;\n can_convert_to_order: boolean;\n}\n\nexport interface Delivery {\n id: string;\n chain_id: string;\n order_id: number;\n order_no: string;\n delivery_no: string;\n delivery_date: string;\n dispatched_qty_kg: number;\n carrier: string | null;\n tracking_ref: string | null;\n status: \"scheduled\" | \"dispatched\" | \"delivered\" | \"cancelled\";\n notes: string | null;\n created_at: string;\n updated_at: string;\n}\n\n// ── MRP / ATP ─────────────────────────────────────────────────────────────\nexport interface ContributingOrder {\n order_id: number;\n order_no: string;\n customer_name: string;\n quantity_kg: number;\n delivery_date: string | null;\n}\n\nexport interface ProductionRequirement {\n product_id: number;\n product_name: string;\n total_ordered_kg: number;\n finished_goods_kg: number;\n production_required_kg: number;\n has_active_formula: boolean;\n contributing_orders: ContributingOrder[];\n}\n\nexport interface SuggestedSupplier {\n supplier_id: number;\n supplier_name: string;\n price: number;\n lead_time_days: number;\n minimum_order_qty: number;\n is_projected: boolean;\n}\n\nexport interface MaterialRequirement {\n material_id: number;\n material_name: string;\n unit: string;\n gross_required: number;\n current_stock: number;\n net_required: number;\n shortage: boolean;\n affected_product_ids: number[];\n suggested_supplier: SuggestedSupplier | null;\n estimated_supply_date: string | null;\n}\n\nexport interface MrpSnapshot {\n production_requirements: ProductionRequirement[];\n material_requirements: MaterialRequirement[];\n has_shortages: boolean;\n}\n\nexport interface FeasibilityResult {\n order_id: number;\n order_no: string;\n outcome: \"feasible\" | \"partially_feasible\" | \"feasible_on_later_date\" | \"at_risk\" | \"not_feasible\";\n required_date: string | null;\n estimated_fulfillment_date: string;\n promptly_available_kg: number;\n remaining_kg: number;\n requested_kg: number;\n constraints: unknown[];\n}\n\n// ── Dashboard ─────────────────────────────────────────────────────────────\nexport interface DashboardSummary {\n open_order_count: number;\n products_with_open_demand: number;\n low_stock_material_count: number;\n low_stock_materials: Material[];\n material_shortage_count: number;\n top_material_shortages: MaterialRequirement[];\n orders_needing_attention_count: number;\n orders_needing_attention: FeasibilityResult[];\n}\n\n// ── Attachments ───────────────────────────────────────────────────────────\nexport interface Attachment {\n id: string;\n entity_type: string;\n entity_id: string;\n file_id: string;\n filename: string;\n label: string | null;\n uploaded_by_subject_id: string | null;\n created_at: string;\n}\n\n// ── Generic list envelope ─────────────────────────────────────────────────\nexport interface ListResponse<T> {\n total: number;\n [key: string]: T[] | number;\n}\n\n// ── Settings ──────────────────────────────────────────────────────────────\nexport interface AppSettings {\n deepseek_model: string;\n deepseek_base_url: string;\n deepseek_api_key_set: boolean;\n deepseek_api_key_preview: string | null;\n\n assistant_system_prompt: string;\n assistant_data_scope: string;\n\n batch_size_kg: number;\n daily_capacity_kg: number;\n planning_horizon_days: number;\n app_name: string;\n\n company_name: string;\n company_address: string;\n company_phone: string;\n company_email: string;\n company_tax_id: string;\n company_website: string;\n company_logo_attachment_id: string | null;\n}\n\nexport interface UpdateSettingsRequest {\n deepseek_api_key?: string;\n deepseek_model?: string;\n deepseek_base_url?: string;\n\n assistant_system_prompt?: string;\n assistant_data_scope?: string;\n\n batch_size_kg?: number;\n daily_capacity_kg?: number;\n planning_horizon_days?: number;\n app_name?: string;\n\n company_name?: string;\n company_address?: string;\n company_phone?: string;\n company_email?: string;\n company_tax_id?: string;\n company_website?: string;\n company_logo_attachment_id?: string;\n}\n\n// ── Production Cycle ──────────────────────────────────────────────────────\nexport interface RawMaterialRequirementLine {\n material_id: number;\n material_name: string;\n unit: string;\n quantity_per_batch: number;\n}\n\nexport interface ProductionCycle {\n product_id: number;\n batch_size: number;\n batch_size_unit: string;\n time_per_batch_minutes: number;\n finished_products_per_batch: number;\n output_per_batch: number;\n output_per_batch_unit: string;\n manpower_required: number;\n machinery_required: string;\n special_requirements: string | null;\n raw_material_requirements: RawMaterialRequirementLine[];\n has_active_formula: boolean;\n updated_at: string;\n}\n\nexport interface ProductionCycleUpsertRequest {\n batch_size: number;\n batch_size_unit: string;\n time_per_batch_minutes: number;\n finished_products_per_batch: number;\n output_per_batch: number;\n output_per_batch_unit: string;\n manpower_required: number;\n machinery_required: string;\n special_requirements: string | null;\n}\n"}, "bdff8a28c83dd3dd8d1fafb3eb66bd703413e343": {"t": 1785754544.853877, "n": 9170, "h": "bb31c7534fb34a56", "c": "// ── Auth ──────────────────────────────────────────────────────────────────\nexport interface TokenResponse {\n access_token: string;\n access_token_expires_at: number;\n refresh_token: string;\n}\n\nexport interface MeResponse {\n subject_id: string;\n email: string | null;\n full_name: string | null;\n department: string | null;\n roles: string[];\n permissions: string[];\n}\n\n// ── Users ─────────────────────────────────────────────────────────────────\nexport interface UserSummary {\n subject_id: string;\n email: string;\n full_name: string | null;\n phone: string | null;\n department: string | null;\n status: string;\n roles: string[];\n created_at: string;\n}\n\nexport interface AuditEntry {\n actor_subject_id: string;\n action: string;\n target_subject_id: string;\n previous_state: Record<string, unknown> | null;\n new_state: Record<string, unknown> | null;\n created_at: string;\n}\n\n// ── Customers ─────────────────────────────────────────────────────────────\nexport interface OrderHistoryEntry {\n id: number;\n order_no: string;\n quantity_kg: number;\n delivery_date: string | null;\n status: string;\n priority: string;\n product_name: string;\n}\n\nexport interface Customer {\n id: number;\n name: string;\n contact_person: string | null;\n email: string | null;\n phone: string | null;\n address: string | null;\n billing_address: string | null;\n gstin: string | null;\n payment_terms: string | null;\n credit_limit: number;\n status: string;\n notes: string | null;\n created_at: string;\n updated_at: string;\n orders?: OrderHistoryEntry[];\n}\n\n// ── Materials & Inventory ─────────────────────────────────────────────────\nexport interface ProductRef {\n id: number;\n name: string;\n}\n\nexport interface MovementEntry {\n id: number;\n movement_type: \"receipt\" | \"consumption\" | \"adjustment\";\n quantity: number;\n reference: string | null;\n actor_subject_id: string | null;\n created_at: string;\n}\n\nexport interface Material {\n id: number;\n name: string;\n unit: string;\n status: string;\n current_stock: number;\n minimum_stock: number;\n reorder_point: number;\n lead_time_days: number;\n used_by_products?: ProductRef[];\n recent_movements?: MovementEntry[];\n}\n\n// ── Suppliers ─────────────────────────────────────────────────────────────\nexport interface MaterialSupplyTerm {\n id: number;\n material_id: number;\n material_name: string;\n unit: string;\n price: number;\n lead_time_days: number;\n minimum_order_qty: number;\n payment_terms: string | null;\n delivery_cost: number;\n}\n\nexport interface Supplier {\n id: number;\n name: string;\n contact_person: string | null;\n phone: string | null;\n email: string | null;\n address: string | null;\n gstin: string | null;\n category: string | null;\n rating: number | null;\n status: string;\n notes: string | null;\n created_at: string;\n materials_supplied?: MaterialSupplyTerm[];\n}\n\n// ── Products & Formulas ───────────────────────────────────────────────────\nexport interface FormulaLine {\n material_id: number;\n material_name: string;\n unit: string;\n quantity_per_unit: number;\n}\n\nexport interface Formula {\n id: number;\n product_id: number;\n version: number;\n effective_from: string;\n is_active: boolean;\n created_at: string;\n lines: FormulaLine[];\n}\n\nexport interface FormulaVersionSummary {\n id: number;\n version: number;\n effective_from: string;\n is_active: boolean;\n created_at: string;\n}\n\nexport interface FinishedGoods {\n product_id: number;\n available_kg: number;\n available_bags: number;\n updated_at: string;\n}\n\nexport interface Product {\n id: number;\n name: string;\n category: string | null;\n unit_of_measure: string;\n default_bag_size_kg: number;\n status: string;\n created_at: string;\n active_formula?: Formula | null;\n formula_versions?: FormulaVersionSummary[];\n finished_goods?: FinishedGoods | null;\n}\n\n// ── Customer Orders ───────────────────────────────────────────────────────\nexport interface Availability {\n available_kg: number;\n required_kg: number;\n shortfall_kg: number;\n fulfillable_from_stock: boolean;\n}\n\nexport interface Order {\n id: number;\n order_no: string;\n customer_id: number;\n customer_name: string;\n product_id: number;\n product_name: string;\n quantity_kg: number;\n bag_size_kg: number;\n bags: number;\n delivery_date: string | null;\n status: string;\n priority: \"critical\" | \"high\" | \"normal\" | \"low\";\n notes: string | null;\n created_at: string;\n updated_at: string;\n availability?: Availability;\n}\n\nexport const ORDER_STATUSES = [\n \"draft\", \"confirmed\", \"planned\", \"partially_fulfilled\",\n \"fulfilled\", \"at_risk\", \"delayed\", \"cancelled\",\n] as const;\n\n// ── MRP / ATP ─────────────────────────────────────────────────────────────\nexport interface ContributingOrder {\n order_id: number;\n order_no: string;\n customer_name: string;\n quantity_kg: number;\n delivery_date: string | null;\n}\n\nexport interface ProductionRequirement {\n product_id: number;\n product_name: string;\n total_ordered_kg: number;\n finished_goods_kg: number;\n production_required_kg: number;\n has_active_formula: boolean;\n contributing_orders: ContributingOrder[];\n}\n\nexport interface SuggestedSupplier {\n supplier_id: number;\n supplier_name: string;\n price: number;\n lead_time_days: number;\n minimum_order_qty: number;\n is_projected: boolean;\n}\n\nexport interface MaterialRequirement {\n material_id: number;\n material_name: string;\n unit: string;\n gross_required: number;\n current_stock: number;\n net_required: number;\n shortage: boolean;\n affected_product_ids: number[];\n suggested_supplier: SuggestedSupplier | null;\n estimated_supply_date: string | null;\n}\n\nexport interface MrpSnapshot {\n production_requirements: ProductionRequirement[];\n material_requirements: MaterialRequirement[];\n has_shortages: boolean;\n}\n\nexport interface FeasibilityResult {\n order_id: number;\n order_no: string;\n outcome: \"feasible\" | \"partially_feasible\" | \"feasible_on_later_date\" | \"at_risk\" | \"not_feasible\";\n required_date: string | null;\n estimated_fulfillment_date: string;\n promptly_available_kg: number;\n remaining_kg: number;\n requested_kg: number;\n constraints: unknown[];\n}\n\n// ── Dashboard ─────────────────────────────────────────────────────────────\nexport interface DashboardSummary {\n open_order_count: number;\n products_with_open_demand: number;\n low_stock_material_count: number;\n low_stock_materials: Material[];\n material_shortage_count: number;\n top_material_shortages: MaterialRequirement[];\n orders_needing_attention_count: number;\n orders_needing_attention: FeasibilityResult[];\n}\n\n// ── Attachments ───────────────────────────────────────────────────────────\nexport interface Attachment {\n id: string;\n entity_type: string;\n entity_id: string;\n file_id: string;\n filename: string;\n label: string | null;\n uploaded_by_subject_id: string | null;\n created_at: string;\n}\n\n// ── Generic list envelope ─────────────────────────────────────────────────\nexport interface ListResponse<T> {\n total: number;\n [key: string]: T[] | number;\n}\n\n// ── Settings ──────────────────────────────────────────────────────────────\nexport interface AppSettings {\n deepseek_model: string;\n deepseek_base_url: string;\n deepseek_api_key_set: boolean;\n deepseek_api_key_preview: string | null;\n\n assistant_system_prompt: string;\n assistant_data_scope: string;\n\n batch_size_kg: number;\n daily_capacity_kg: number;\n planning_horizon_days: number;\n app_name: string;\n\n company_name: string;\n company_address: string;\n company_phone: string;\n company_email: string;\n company_tax_id: string;\n company_website: string;\n company_logo_attachment_id: string | null;\n}\n\nexport interface UpdateSettingsRequest {\n deepseek_api_key?: string;\n deepseek_model?: string;\n deepseek_base_url?: string;\n\n assistant_system_prompt?: string;\n assistant_data_scope?: string;\n\n batch_size_kg?: number;\n daily_capacity_kg?: number;\n planning_horizon_days?: number;\n app_name?: string;\n\n company_name?: string;\n company_address?: string;\n company_phone?: string;\n company_email?: string;\n company_tax_id?: string;\n company_website?: string;\n company_logo_attachment_id?: string;\n}\n\n// ── Production Cycle ──────────────────────────────────────────────────────\nexport interface RawMaterialRequirementLine {\n material_id: number;\n material_name: string;\n unit: string;\n quantity_per_batch: number;\n}\n\nexport interface ProductionCycle {\n product_id: number;\n batch_size: number;\n batch_size_unit: string;\n time_per_batch_minutes: number;\n finished_products_per_batch: number;\n output_per_batch: number;\n output_per_batch_unit: string;\n manpower_required: number;\n machinery_required: string;\n special_requirements: string | null;\n raw_material_requirements: RawMaterialRequirementLine[];\n has_active_formula: boolean;\n updated_at: string;\n}\n\nexport interface ProductionCycleUpsertRequest {\n batch_size: number;\n batch_size_unit: string;\n time_per_batch_minutes: number;\n finished_products_per_batch: number;\n output_per_batch: number;\n output_per_batch_unit: string;\n manpower_required: number;\n machinery_required: string;\n special_requirements: string | null;\n}\n"}, "71a4deb23fd683c36365e611a384448e9df8b84f": {"t": 1785754546.3622665, "n": 7940, "h": "398fa7c56f769617", "c": "// ── Auth ──────────────────────────────────────────────────────────────────\nexport interface TokenResponse {\n access_token: string;\n access_token_expires_at: number;\n refresh_token: string;\n}\n\nexport interface MeResponse {\n subject_id: string;\n email: string | null;\n full_name: string | null;\n department: string | null;\n roles: string[];\n permissions: string[];\n}\n\n// ── Users ─────────────────────────────────────────────────────────────────\nexport interface UserSummary {\n subject_id: string;\n email: string;\n full_name: string | null;\n phone: string | null;\n department: string | null;\n status: string;\n roles: string[];\n created_at: string;\n}\n\nexport interface AuditEntry {\n actor_subject_id: string;\n action: string;\n target_subject_id: string;\n previous_state: Record<string, unknown> | null;\n new_state: Record<string, unknown> | null;\n created_at: string;\n}\n\n// ── Customers ─────────────────────────────────────────────────────────────\nexport interface OrderHistoryEntry {\n id: number;\n order_no: string;\n quantity_kg: number;\n delivery_date: string | null;\n status: string;\n priority: string;\n product_name: string;\n}\n\nexport interface Customer {\n id: number;\n name: string;\n contact_person: string | null;\n email: string | null;\n phone: string | null;\n address: string | null;\n billing_address: string | null;\n gstin: string | null;\n payment_terms: string | null;\n credit_limit: number;\n status: string;\n notes: string | null;\n created_at: string;\n updated_at: string;\n orders?: OrderHistoryEntry[];\n}\n\n// ── Materials & Inventory ─────────────────────────────────────────────────\nexport interface ProductRef {\n id: number;\n name: string;\n}\n\nexport interface MovementEntry {\n id: number;\n movement_type: \"receipt\" | \"consumption\" | \"adjustment\";\n quantity: number;\n reference: string | null;\n actor_subject_id: string | null;\n created_at: string;\n}\n\nexport interface Material {\n id: number;\n name: string;\n unit: string;\n status: string;\n current_stock: number;\n minimum_stock: number;\n reorder_point: number;\n lead_time_days: number;\n used_by_products?: ProductRef[];\n recent_movements?: MovementEntry[];\n}\n\n// ── Suppliers ─────────────────────────────────────────────────────────────\nexport interface MaterialSupplyTerm {\n id: number;\n material_id: number;\n material_name: string;\n unit: string;\n price: number;\n lead_time_days: number;\n minimum_order_qty: number;\n payment_terms: string | null;\n delivery_cost: number;\n}\n\nexport interface Supplier {\n id: number;\n name: string;\n contact_person: string | null;\n phone: string | null;\n email: string | null;\n address: string | null;\n gstin: string | null;\n category: string | null;\n rating: number | null;\n status: string;\n notes: string | null;\n created_at: string;\n materials_supplied?: MaterialSupplyTerm[];\n}\n\n// ── Products & Formulas ───────────────────────────────────────────────────\nexport interface FormulaLine {\n material_id: number;\n material_name: string;\n unit: string;\n quantity_per_unit: number;\n}\n\nexport interface Formula {\n id: number;\n product_id: number;\n version: number;\n effective_from: string;\n is_active: boolean;\n created_at: string;\n lines: FormulaLine[];\n}\n\nexport interface FormulaVersionSummary {\n id: number;\n version: number;\n effective_from: string;\n is_active: boolean;\n created_at: string;\n}\n\nexport interface FinishedGoods {\n product_id: number;\n available_kg: number;\n available_bags: number;\n updated_at: string;\n}\n\nexport interface Product {\n id: number;\n name: string;\n category: string | null;\n unit_of_measure: string;\n default_bag_size_kg: number;\n status: string;\n created_at: string;\n active_formula?: Formula | null;\n formula_versions?: FormulaVersionSummary[];\n finished_goods?: FinishedGoods | null;\n}\n\n// ── Customer Orders ───────────────────────────────────────────────────────\nexport interface Availability {\n available_kg: number;\n required_kg: number;\n shortfall_kg: number;\n fulfillable_from_stock: boolean;\n}\n\nexport interface Order {\n id: number;\n order_no: string;\n customer_id: number;\n customer_name: string;\n product_id: number;\n product_name: string;\n quantity_kg: number;\n bag_size_kg: number;\n bags: number;\n delivery_date: string | null;\n status: string;\n priority: \"critical\" | \"high\" | \"normal\" | \"low\";\n notes: string | null;\n created_at: string;\n updated_at: string;\n availability?: Availability;\n}\n\nexport const ORDER_STATUSES = [\n \"draft\", \"confirmed\", \"planned\", \"partially_fulfilled\",\n \"fulfilled\", \"at_risk\", \"delayed\", \"cancelled\",\n] as const;\n\n// ── MRP / ATP ─────────────────────────────────────────────────────────────\nexport interface ContributingOrder {\n order_id: number;\n order_no: string;\n customer_name: string;\n quantity_kg: number;\n delivery_date: string | null;\n}\n\nexport interface ProductionRequirement {\n product_id: number;\n product_name: string;\n total_ordered_kg: number;\n finished_goods_kg: number;\n production_required_kg: number;\n has_active_formula: boolean;\n contributing_orders: ContributingOrder[];\n}\n\nexport interface SuggestedSupplier {\n supplier_id: number;\n supplier_name: string;\n price: number;\n lead_time_days: number;\n minimum_order_qty: number;\n is_projected: boolean;\n}\n\nexport interface MaterialRequirement {\n material_id: number;\n material_name: string;\n unit: string;\n gross_required: number;\n current_stock: number;\n net_required: number;\n shortage: boolean;\n affected_product_ids: number[];\n suggested_supplier: SuggestedSupplier | null;\n estimated_supply_date: string | null;\n}\n\nexport interface MrpSnapshot {\n production_requirements: ProductionRequirement[];\n material_requirements: MaterialRequirement[];\n has_shortages: boolean;\n}\n\nexport interface FeasibilityResult {\n order_id: number;\n order_no: string;\n outcome: \"feasible\" | \"partially_feasible\" | \"feasible_on_later_date\" | \"at_risk\" | \"not_feasible\";\n required_date: string | null;\n estimated_fulfillment_date: string;\n promptly_available_kg: number;\n remaining_kg: number;\n requested_kg: number;\n constraints: unknown[];\n}\n\n// ── Dashboard ─────────────────────────────────────────────────────────────\nexport interface DashboardSummary {\n open_order_count: number;\n products_with_open_demand: number;\n low_stock_material_count: number;\n low_stock_materials: Material[];\n material_shortage_count: number;\n top_material_shortages: MaterialRequirement[];\n orders_needing_attention_count: number;\n orders_needing_attention: FeasibilityResult[];\n}\n\n// ── Attachments ───────────────────────────────────────────────────────────\nexport interface Attachment {\n id: string;\n entity_type: string;\n entity_id: string;\n file_id: string;\n filename: string;\n label: string | null;\n uploaded_by_subject_id: string | null;\n created_at: string;\n}\n\n// ── Generic list envelope ─────────────────────────────────────────────────\nexport interface ListResponse<T> {\n total: number;\n [key: string]: T[] | number;\n}\n\n// ── Settings ──────────────────────────────────────────────────────────────\nexport interface AppSettings {\n deepseek_model: string;\n deepseek_base_url: string;\n deepseek_api_key_set: boolean;\n deepseek_api_key_preview: string | null;\n\n batch_size_kg: number;\n daily_capacity_kg: number;\n planning_horizon_days: number;\n app_name: string;\n\n company_name: string;\n company_address: string;\n company_phone: string;\n company_email: string;\n company_gstin: string;\n company_website: string;\n}\n\nexport interface UpdateSettingsRequest {\n deepseek_api_key?: string;\n deepseek_model?: string;\n deepseek_base_url?: string;\n\n batch_size_kg?: number;\n daily_capacity_kg?: number;\n planning_horizon_days?: number;\n app_name?: string;\n\n company_name?: string;\n company_address?: string;\n company_phone?: string;\n company_email?: string;\n company_gstin?: string;\n company_website?: string;\n}\n"}, "85b8b5a19cb223ed0ecc0ee946c47b49c2caaca2": {"t": 1785754547.619683, "n": 7033, "h": "0717d319ea241afe", "c": "// ── Auth ──────────────────────────────────────────────────────────────────\nexport interface TokenResponse {\n access_token: string;\n access_token_expires_at: number;\n refresh_token: string;\n}\n\nexport interface MeResponse {\n subject_id: string;\n email: string | null;\n full_name: string | null;\n department: string | null;\n roles: string[];\n permissions: string[];\n}\n\n// ── Users ─────────────────────────────────────────────────────────────────\nexport interface UserSummary {\n subject_id: string;\n email: string;\n full_name: string | null;\n phone: string | null;\n department: string | null;\n status: string;\n roles: string[];\n created_at: string;\n}\n\nexport interface AuditEntry {\n actor_subject_id: string;\n action: string;\n target_subject_id: string;\n previous_state: Record<string, unknown> | null;\n new_state: Record<string, unknown> | null;\n created_at: string;\n}\n\n// ── Customers ─────────────────────────────────────────────────────────────\nexport interface OrderHistoryEntry {\n id: number;\n order_no: string;\n quantity_kg: number;\n delivery_date: string | null;\n status: string;\n priority: string;\n product_name: string;\n}\n\nexport interface Customer {\n id: number;\n name: string;\n contact_person: string | null;\n email: string | null;\n phone: string | null;\n address: string | null;\n billing_address: string | null;\n gstin: string | null;\n payment_terms: string | null;\n credit_limit: number;\n status: string;\n notes: string | null;\n created_at: string;\n updated_at: string;\n orders?: OrderHistoryEntry[];\n}\n\n// ── Materials & Inventory ─────────────────────────────────────────────────\nexport interface ProductRef {\n id: number;\n name: string;\n}\n\nexport interface MovementEntry {\n id: number;\n movement_type: \"receipt\" | \"consumption\" | \"adjustment\";\n quantity: number;\n reference: string | null;\n actor_subject_id: string | null;\n created_at: string;\n}\n\nexport interface Material {\n id: number;\n name: string;\n unit: string;\n status: string;\n current_stock: number;\n minimum_stock: number;\n reorder_point: number;\n lead_time_days: number;\n used_by_products?: ProductRef[];\n recent_movements?: MovementEntry[];\n}\n\n// ── Suppliers ─────────────────────────────────────────────────────────────\nexport interface MaterialSupplyTerm {\n id: number;\n material_id: number;\n material_name: string;\n unit: string;\n price: number;\n lead_time_days: number;\n minimum_order_qty: number;\n payment_terms: string | null;\n delivery_cost: number;\n}\n\nexport interface Supplier {\n id: number;\n name: string;\n contact_person: string | null;\n phone: string | null;\n email: string | null;\n address: string | null;\n gstin: string | null;\n category: string | null;\n rating: number | null;\n status: string;\n notes: string | null;\n created_at: string;\n materials_supplied?: MaterialSupplyTerm[];\n}\n\n// ── Products & Formulas ───────────────────────────────────────────────────\nexport interface FormulaLine {\n material_id: number;\n material_name: string;\n unit: string;\n quantity_per_unit: number;\n}\n\nexport interface Formula {\n id: number;\n product_id: number;\n version: number;\n effective_from: string;\n is_active: boolean;\n created_at: string;\n lines: FormulaLine[];\n}\n\nexport interface FormulaVersionSummary {\n id: number;\n version: number;\n effective_from: string;\n is_active: boolean;\n created_at: string;\n}\n\nexport interface FinishedGoods {\n product_id: number;\n available_kg: number;\n available_bags: number;\n updated_at: string;\n}\n\nexport interface Product {\n id: number;\n name: string;\n category: string | null;\n unit_of_measure: string;\n default_bag_size_kg: number;\n status: string;\n created_at: string;\n active_formula?: Formula | null;\n formula_versions?: FormulaVersionSummary[];\n finished_goods?: FinishedGoods | null;\n}\n\n// ── Customer Orders ───────────────────────────────────────────────────────\nexport interface Availability {\n available_kg: number;\n required_kg: number;\n shortfall_kg: number;\n fulfillable_from_stock: boolean;\n}\n\nexport interface Order {\n id: number;\n order_no: string;\n customer_id: number;\n customer_name: string;\n product_id: number;\n product_name: string;\n quantity_kg: number;\n bag_size_kg: number;\n bags: number;\n delivery_date: string | null;\n status: string;\n priority: \"critical\" | \"high\" | \"normal\" | \"low\";\n notes: string | null;\n created_at: string;\n updated_at: string;\n availability?: Availability;\n}\n\nexport const ORDER_STATUSES = [\n \"draft\", \"confirmed\", \"planned\", \"partially_fulfilled\",\n \"fulfilled\", \"at_risk\", \"delayed\", \"cancelled\",\n] as const;\n\n// ── MRP / ATP ─────────────────────────────────────────────────────────────\nexport interface ContributingOrder {\n order_id: number;\n order_no: string;\n customer_name: string;\n quantity_kg: number;\n delivery_date: string | null;\n}\n\nexport interface ProductionRequirement {\n product_id: number;\n product_name: string;\n total_ordered_kg: number;\n finished_goods_kg: number;\n production_required_kg: number;\n has_active_formula: boolean;\n contributing_orders: ContributingOrder[];\n}\n\nexport interface SuggestedSupplier {\n supplier_id: number;\n supplier_name: string;\n price: number;\n lead_time_days: number;\n minimum_order_qty: number;\n is_projected: boolean;\n}\n\nexport interface MaterialRequirement {\n material_id: number;\n material_name: string;\n unit: string;\n gross_required: number;\n current_stock: number;\n net_required: number;\n shortage: boolean;\n affected_product_ids: number[];\n suggested_supplier: SuggestedSupplier | null;\n estimated_supply_date: string | null;\n}\n\nexport interface MrpSnapshot {\n production_requirements: ProductionRequirement[];\n material_requirements: MaterialRequirement[];\n has_shortages: boolean;\n}\n\nexport interface FeasibilityResult {\n order_id: number;\n order_no: string;\n outcome: \"feasible\" | \"partially_feasible\" | \"feasible_on_later_date\" | \"at_risk\" | \"not_feasible\";\n required_date: string | null;\n estimated_fulfillment_date: string;\n promptly_available_kg: number;\n remaining_kg: number;\n requested_kg: number;\n constraints: unknown[];\n}\n\n// ── Dashboard ─────────────────────────────────────────────────────────────\nexport interface DashboardSummary {\n open_order_count: number;\n products_with_open_demand: number;\n low_stock_material_count: number;\n low_stock_materials: Material[];\n material_shortage_count: number;\n top_material_shortages: MaterialRequirement[];\n orders_needing_attention_count: number;\n orders_needing_attention: FeasibilityResult[];\n}\n\n// ── Attachments ───────────────────────────────────────────────────────────\nexport interface Attachment {\n id: string;\n entity_type: string;\n entity_id: string;\n file_id: string;\n filename: string;\n label: string | null;\n uploaded_by_subject_id: string | null;\n created_at: string;\n}\n\n// ── Generic list envelope ─────────────────────────────────────────────────\nexport interface ListResponse<T> {\n total: number;\n [key: string]: T[] | number;\n}\n"}}}} |