import json

from typing import Optional


class SkimType(object):
    ALL = 0
    SKIM = 1
    CHANGE_FUND = 2


class GLAccount(object):

    def __init__(
        self,               # type: GLAccount
        manager="",         # type: str
        envelope="",        # type: str
        justification="",   # type: str
        skim_type=None,     # type: Optional[int]
    ):
        # type: (...) -> None

        self.manager = manager
        self.envelope = envelope
        self.justification = justification
        if skim_type is not None:
            self.type = skim_type

    def to_json(
        self,   # type: GLAccount
    ):
        # type: (...) -> str

        return json.dumps(
            obj=self,
            default=lambda o: o.__dict__,
            sort_keys=True,
        )
