def _create_from_draft(
         self,
         draft: types.CartDiscountDraft,
         id: typing.Optional[str] = None) -> types.CartDiscount:
     object_id = str(uuid.UUID(id) if id is not None else uuid.uuid4())
     return types.CartDiscount(
         id=str(object_id),
         version=1,
         key=draft.key,
         name=draft.name,
         description=draft.description,
         value=draft.value,
         target=draft.target,
         cart_predicate=draft.cart_predicate,
         is_active=draft.is_active or False,
         references=[],
         stacking_mode=draft.stacking_mode or types.StackingMode.STACKING,
         sort_order=draft.sort_order,
         valid_from=draft.valid_from,
         valid_until=draft.valid_until,
         requires_discount_code=draft.requires_discount_code,
         created_at=datetime.datetime.now(datetime.timezone.utc),
         last_modified_at=datetime.datetime.now(datetime.timezone.utc),
         custom=utils.create_from_draft(draft.custom),
     )
 def post_load(self, data):
     return types.CartDiscount(**data)