Kanban Rules - create automatically X++

Hello,
i would like to create a Kanban Rule by code. Do you have any examples please ?
Same result as in the form\KanbanRules.

My input parameters are :

  • kanbanType (Withdrawa)
  • First plan activity
  • ItemId
  • Default quantity
  • Fixed kanban quantity

It’s not easy with all of these tables (KanbanRule, KanbanRuleFixed, KanbanFlow, LeanCoverage, PlanActivity, …)
Thanks