from dataclasses import dataclass

from plug.abstract import Model

# Define your plugin's models here.

@dataclass
class BalanceModel(Model):
    fqdn = "tutorial.BalanceModel"
    balance: int = 0

    @classmethod
    def default_factory(cls):
        return cls(balance = 100)

    @staticmethod
    def pack(registry, obj):
        return {
            "balance": obj.balance,
        }

    @classmethod
    def unpack(cls, registry, payload):
        return cls(
            balance=payload["balance"]
        )

d797dca805001ad3ba433e60cc6952fb9e253f9e
<mask token>


@dataclass
class BalanceModel(Model):
    <mask token>
    balance: int = 0

    @classmethod
    def default_factory(cls):
        return cls(balance=100)

    @staticmethod
    def pack(registry, obj):
        return {'balance': obj.balance}
    <mask token>

<mask token>


@dataclass
class BalanceModel(Model):
    <mask token>
    balance: int = 0

    @classmethod
    def default_factory(cls):
        return cls(balance=100)

    @staticmethod
    def pack(registry, obj):
        return {'balance': obj.balance}

    @classmethod
    def unpack(cls, registry, payload):
        return cls(balance=payload['balance'])

<mask token>


@dataclass
class BalanceModel(Model):
    fqdn = 'tutorial.BalanceModel'
    balance: int = 0

    @classmethod
    def default_factory(cls):
        return cls(balance=100)

    @staticmethod
    def pack(registry, obj):
        return {'balance': obj.balance}

    @classmethod
    def unpack(cls, registry, payload):
        return cls(balance=payload['balance'])

from dataclasses import dataclass
from plug.abstract import Model


@dataclass
class BalanceModel(Model):
    fqdn = 'tutorial.BalanceModel'
    balance: int = 0

    @classmethod
    def default_factory(cls):
        return cls(balance=100)

    @staticmethod
    def pack(registry, obj):
        return {'balance': obj.balance}

    @classmethod
    def unpack(cls, registry, payload):
        return cls(balance=payload['balance'])

from dataclasses import dataclass

from plug.abstract import Model

# Define your plugin's models here.

@dataclass
class BalanceModel(Model):
    fqdn = "tutorial.BalanceModel"
    balance: int = 0

    @classmethod
    def default_factory(cls):
        return cls(balance = 100)

    @staticmethod
    def pack(registry, obj):
        return {
            "balance": obj.balance,
        }

    @classmethod
    def unpack(cls, registry, payload):
        return cls(
            balance=payload["balance"]
        )
