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

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

# %% ../../nbs/classes/50_DomoJupyter_Account.ipynb 2
from ..routes.jupyter import JupyterAPI_Error

# %% ../../nbs/classes/50_DomoJupyter_Account.ipynb 3
import os
import json

from dataclasses import dataclass, field
from typing import List
import datetime as dt

import httpx

import domolibrary.utils.DictDot as util_dd
from dateutil.parser import parse

import domolibrary.client.DomoAuth as dmda
import domolibrary.routes.jupyter as jupyter_routes
import domolibrary.classes.DomoAccount as dmacc
import domolibrary.classes.DomoDataset as dmds
import domolibrary.classes.DomoUser as dmdu


import domolibrary.client.DomoError as de
import domolibrary.utils.chunk_execution as ce

from nbdev.showdoc import patch_to

# %% ../../nbs/classes/50_DomoJupyter_Account.ipynb 8
@dataclass(order=True)
class DomoJupyterAccount:
    auth: dmd.DomoAuth = field(init=False)
    sort_index: int = field(init=False)
    
    account_id: str
    alias: str
    
    domo_account : dmacc.DomoAccount = field(default = None)
    
    def __post_init__(self):
           self.sort_index = self.alias

    def __eq__(self, other):
        if self.__class__.__name__ != other.__class__.__name__:
            return False

        return self.account_id == other.account_id

    @classmethod
    def _from_json(cls, obj, auth :dmda.DomoAuth):
        return cls(account_id=obj["account_id"], 
                   alias=obj["alias"],
                   auth = auth
                  )

    def to_json(self):
        return {"account_id": self.account_id, "alias": self.alias}

    


