{"id":"inventory-fifo-periodic-value","version":"1.0.0","description":"Value ending inventory and cost of goods sold under periodic FIFO with exact, reproducible layer retention.","supported_operations":["periodic FIFO inventory valuation","calculate FIFO COGS","value physical ending inventory","retain FIFO ending layers","exact FIFO cost flow","periodic inventory cost schedule"],"unsupported_operations":["perpetual FIFO transaction processing","tax or legal advice"],"semantics":["Periodic FIFO assigns the earliest available units to cost of goods sold and retains the latest units in ending inventory; it does not model intra-period sales.","Layers sort by acquired_on ascending, then beginning before purchase, then zero-based input_index, then layer_id; input_index makes equal-date ties explicit and deterministic.","Quantities and unit costs are canonical nonnegative decimal strings. All products and sums use integer/rational arithmetic; binary floating point is never used.","output_scale is explicit (0 through 12). Rounding is final, independently for each displayed monetary total and layer extended cost; it is not per-unit or cumulative. Supported modes are half-up, half-even, half-down, up, down, ceiling and floor.","Inputs are immutable. Output contains reference_version IAS-2-2024-25-27+periodic-FIFO-v1.","Disclaimer: arithmetic calculation only; not financial, tax, legal, or investment advice."],"limits":{"max_input_bytes":131072,"max_layers_per_source":500,"max_layers":1000,"max_string_bytes":64,"max_output_bytes":8192},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["beginning_layers","purchases","physical_ending_quantity","output_scale","rounding_mode"],"properties":{"beginning_layers":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["layer_id","acquired_on","quantity","unit_cost"],"properties":{"layer_id":{"type":"string","minLength":1,"maxLength":64},"acquired_on":{"type":"string","pattern":"^[0-9]{4}-[0-9]{2}-[0-9]{2}$"},"quantity":{"type":"string","pattern":"^(0|[1-9][0-9]{0,17})(\\.[0-9]{1,12})?$","maxLength":32},"unit_cost":{"type":"string","pattern":"^(0|[1-9][0-9]{0,17})(\\.[0-9]{1,12})?$","maxLength":32}}},"maxItems":500},"purchases":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["layer_id","acquired_on","quantity","unit_cost"],"properties":{"layer_id":{"type":"string","minLength":1,"maxLength":64},"acquired_on":{"type":"string","pattern":"^[0-9]{4}-[0-9]{2}-[0-9]{2}$"},"quantity":{"type":"string","pattern":"^(0|[1-9][0-9]{0,17})(\\.[0-9]{1,12})?$","maxLength":32},"unit_cost":{"type":"string","pattern":"^(0|[1-9][0-9]{0,17})(\\.[0-9]{1,12})?$","maxLength":32}}},"maxItems":500},"physical_ending_quantity":{"type":"string","pattern":"^(0|[1-9][0-9]{0,17})(\\.[0-9]{1,12})?$","maxLength":32},"output_scale":{"type":"integer","minimum":0,"maximum":12},"rounding_mode":{"type":"string","enum":["half-up","half-even","half-down","up","down","ceiling","floor"]}}},"output_schema":{"type":"object","additionalProperties":false,"required":["reference_version","available_quantity","ending_quantity","sold_quantity","goods_available_cost","ending_inventory","cogs","ending_layers"],"properties":{"reference_version":{"type":"string","const":"IAS-2-2024-25-27+periodic-FIFO-v1"},"available_quantity":{"type":"string"},"ending_quantity":{"type":"string"},"sold_quantity":{"type":"string"},"goods_available_cost":{"type":"string"},"ending_inventory":{"type":"string"},"cogs":{"type":"string"},"ending_layers":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["layer_id","source","input_index","acquired_on","quantity","unit_cost","extended_cost"],"properties":{"layer_id":{"type":"string"},"source":{"type":"string","enum":["beginning","purchase"]},"input_index":{"type":"integer","minimum":0,"maximum":499},"acquired_on":{"type":"string"},"quantity":{"type":"string"},"unit_cost":{"type":"string"},"extended_cost":{"type":"string"}}},"maxItems":1000}}},"examples":[{"input":{"beginning_layers":[{"layer_id":"B1","acquired_on":"2026-01-01","quantity":"10","unit_cost":"2.00"}],"purchases":[{"layer_id":"P1","acquired_on":"2026-01-10","quantity":"5","unit_cost":"3.00"}],"physical_ending_quantity":"6","output_scale":2,"rounding_mode":"half-up"},"output":{"reference_version":"IAS-2-2024-25-27+periodic-FIFO-v1","available_quantity":"15","ending_quantity":"6","sold_quantity":"9","goods_available_cost":"35.00","ending_inventory":"17.00","cogs":"18.00","ending_layers":[{"layer_id":"B1","source":"beginning","input_index":0,"acquired_on":"2026-01-01","quantity":"1","unit_cost":"2","extended_cost":"2.00"},{"layer_id":"P1","source":"purchase","input_index":0,"acquired_on":"2026-01-10","quantity":"5","unit_cost":"3","extended_cost":"15.00"}]}},{"input":{"beginning_layers":[{"layer_id":"B1","acquired_on":"2026-01-01","quantity":"3","unit_cost":"1.25"}],"purchases":[{"layer_id":"P1","acquired_on":"2026-01-02","quantity":"4","unit_cost":"2.50"},{"layer_id":"P2","acquired_on":"2026-01-03","quantity":"2","unit_cost":"4.00"}],"physical_ending_quantity":"5","output_scale":2,"rounding_mode":"half-even"},"output":{"reference_version":"IAS-2-2024-25-27+periodic-FIFO-v1","available_quantity":"9","ending_quantity":"5","sold_quantity":"4","goods_available_cost":"21.75","ending_inventory":"15.50","cogs":"6.25","ending_layers":[{"layer_id":"P1","source":"purchase","input_index":0,"acquired_on":"2026-01-02","quantity":"3","unit_cost":"2.5","extended_cost":"7.50"},{"layer_id":"P2","source":"purchase","input_index":1,"acquired_on":"2026-01-03","quantity":"2","unit_cost":"4","extended_cost":"8.00"}]}}],"execute_url":"/v1/tools/inventory-fifo-periodic-value/versions/1.0.0/execute"}