# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/classes/50_DomoGrant.ipynb.

# %% auto 0
__all__ = ['DomoGrant']

# %% ../../nbs/classes/50_DomoGrant.ipynb 2
from dataclasses import dataclass, field

import domolibrary.client.DomoAuth as dmda
import domolibrary.utils.DictDot as util_dd
import domolibrary.routes.grant as grant_routes


# %% ../../nbs/classes/50_DomoGrant.ipynb 3
@dataclass
class DomoGrant:
    id: str
    display_group: str
    title: str
    depends_on_ls: list[str]
    description: str = None
    role_membership_ls: list[str] = field(default=None)

    @classmethod
    def _from_json(cls, obj):

        dd = obj
        if not isinstance(dd, util_dd.DictDot):
            dd = util_dd.DictDot(obj)

        return cls(id=dd.authority,
                   display_group=dd.authorityUIGroup,
                   depends_on_ls=dd.dependsOnAuthorities,
                   title=dd.title,
                   description=dd.description,
                   role_membership_ls=[str(role) for role in dd.roleIds])

