This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2018-10-13 12:53:46 +00:00
|
|
|
from enum import Enum
|
|
|
|
|
2018-10-16 09:13:21 +00:00
|
|
|
import inflection
|
|
|
|
|
2018-10-13 12:53:46 +00:00
|
|
|
from ereuse_devicehub.resources.event import models as e
|
|
|
|
|
|
|
|
|
|
|
|
class State(Enum):
|
|
|
|
@classmethod
|
|
|
|
def events(cls):
|
|
|
|
"""Events participating in this state."""
|
|
|
|
return (s.value for s in cls)
|
|
|
|
|
2018-10-16 09:13:21 +00:00
|
|
|
def __str__(self):
|
2018-10-16 14:30:10 +00:00
|
|
|
return inflection.humanize(inflection.underscore(self.name))
|
2018-10-16 09:13:21 +00:00
|
|
|
|
2018-10-13 12:53:46 +00:00
|
|
|
|
|
|
|
class Trading(State):
|
|
|
|
Reserved = e.Reserve
|
|
|
|
Cancelled = e.CancelTrade
|
|
|
|
Sold = e.Sell
|
|
|
|
Donated = e.Donate
|
|
|
|
Renting = e.Rent
|
|
|
|
# todo add Pay = e.Pay
|
|
|
|
ToBeDisposed = e.ToDisposeProduct
|
|
|
|
ProductDisposed = e.DisposeProduct
|
|
|
|
|
|
|
|
|
|
|
|
class Physical(State):
|
|
|
|
ToBeRepaired = e.ToRepair
|
|
|
|
Repaired = e.Repair
|
|
|
|
Preparing = e.ToPrepare
|
|
|
|
Prepared = e.Prepare
|
|
|
|
ReadyToBeUsed = e.ReadyToUse
|
|
|
|
InUse = e.Live
|