Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libzapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from libzapi.application import AgentAvailability
from libzapi.application import AssetManagement
from libzapi.application import ZendeskStatus
from libzapi.application import WorkforceManagement

__all__ = [
"HelpCenter",
Expand All @@ -12,4 +13,5 @@
"AgentAvailability",
"AssetManagement",
"ZendeskStatus",
"WorkforceManagement",
]
2 changes: 2 additions & 0 deletions libzapi/application/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from libzapi.application.services.agent_availability import AgentAvailability
from libzapi.application.services.asset_management import AssetManagement
from libzapi.application.services.status import ZendeskStatus
from libzapi.application.services.wfm import WorkforceManagement

__all__ = [
"HelpCenter",
Expand All @@ -12,4 +13,5 @@
"AgentAvailability",
"AssetManagement",
"ZendeskStatus",
"WorkforceManagement",
]
Empty file.
10 changes: 10 additions & 0 deletions libzapi/application/commands/wfm/shift_cmds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from dataclasses import dataclass


@dataclass(frozen=True, slots=True)
class FetchShiftsCmd:
startDate: str

Check warning on line 6 in libzapi/application/commands/wfm/shift_cmds.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "startDate" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iS53JYEkI940qCK&open=AZ0S6iS53JYEkI940qCK&pullRequest=62
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Atributos não estão em snake case.

endDate: str

Check warning on line 7 in libzapi/application/commands/wfm/shift_cmds.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "endDate" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iS53JYEkI940qCM&open=AZ0S6iS53JYEkI940qCM&pullRequest=62
agentIds: list[int] | None = None

Check warning on line 8 in libzapi/application/commands/wfm/shift_cmds.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "agentIds" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iS53JYEkI940qCL&open=AZ0S6iS53JYEkI940qCL&pullRequest=62
published: int | None = None
page: int = 1
23 changes: 23 additions & 0 deletions libzapi/application/commands/wfm/team_cmds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from dataclasses import dataclass


@dataclass(frozen=True, slots=True)
class CreateTeamCmd:
name: str
description: str
manager_id: int
agents_ids: list[str]


@dataclass(frozen=True, slots=True)
class UpdateTeamCmd:
name: str | None = None
description: str | None = None
manager_id: int | None = None
agents_ids: list[str] | None = None


@dataclass(frozen=True, slots=True)
class BulkAgentsCmd:
agent_ids: list[str]
team_ids: list[str]
18 changes: 18 additions & 0 deletions libzapi/application/commands/wfm/time_off_cmds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from dataclasses import dataclass, field


@dataclass(frozen=True, slots=True)
class ImportTimeOffEntry:
agentId: int

Check warning on line 6 in libzapi/application/commands/wfm/time_off_cmds.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "agentId" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iQ23JYEkI940qCJ&open=AZ0S6iQ23JYEkI940qCJ&pullRequest=62
startTime: int

Check warning on line 7 in libzapi/application/commands/wfm/time_off_cmds.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "startTime" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iQ23JYEkI940qCF&open=AZ0S6iQ23JYEkI940qCF&pullRequest=62
endTime: int

Check warning on line 8 in libzapi/application/commands/wfm/time_off_cmds.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "endTime" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iQ23JYEkI940qCH&open=AZ0S6iQ23JYEkI940qCH&pullRequest=62
reasonId: str

Check warning on line 9 in libzapi/application/commands/wfm/time_off_cmds.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "reasonId" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iQ23JYEkI940qCI&open=AZ0S6iQ23JYEkI940qCI&pullRequest=62
id: str | None = None
note: str | None = None
status: str | None = None
timeOffType: str | None = None

Check warning on line 13 in libzapi/application/commands/wfm/time_off_cmds.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "timeOffType" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iQ23JYEkI940qCG&open=AZ0S6iQ23JYEkI940qCG&pullRequest=62


@dataclass(frozen=True, slots=True)
class ImportTimeOffCmd:
data: list[ImportTimeOffEntry] = field(default_factory=list)
28 changes: 28 additions & 0 deletions libzapi/application/services/wfm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import libzapi.infrastructure.api_clients.wfm as api
from libzapi.application.services.wfm.activities_service import ActivitiesService
from libzapi.application.services.wfm.reports_service import ReportsService
from libzapi.application.services.wfm.shifts_service import ShiftsService
from libzapi.application.services.wfm.teams_service import TeamsService
from libzapi.application.services.wfm.time_off_service import TimeOffService
from libzapi.infrastructure.http.auth import api_token_headers, oauth_headers
from libzapi.infrastructure.http.client import HttpClient


class WorkforceManagement:
def __init__(
self, base_url: str, oauth_token: str | None = None, email: str | None = None, api_token: str | None = None
):
if oauth_token:
headers = oauth_headers(oauth_token)
elif email and api_token:
headers = api_token_headers(email, api_token)
else:
raise ValueError("Provide oauth_token or email+api_token")

http = HttpClient(base_url, headers=headers)

self.activities = ActivitiesService(api.ActivityApiClient(http))
self.reports = ReportsService(api.ReportApiClient(http))
self.shifts = ShiftsService(api.ShiftApiClient(http))
self.time_off = TimeOffService(api.TimeOffApiClient(http))
self.teams = TeamsService(api.TeamApiClient(http))
17 changes: 17 additions & 0 deletions libzapi/application/services/wfm/activities_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from __future__ import annotations

from typing import Iterable

from libzapi.domain.models.wfm.activity import Activity, ActivityTypeRef, AgentRef
from libzapi.infrastructure.api_clients.wfm import ActivityApiClient


class ActivitiesService:
def __init__(self, client: ActivityApiClient) -> None:
self._client = client

def list(self, start_time: int) -> Iterable[Activity]:
return self._client.list(start_time=start_time)

def list_with_relationships(self, start_time: int) -> tuple[list[Activity], list[AgentRef], list[ActivityTypeRef]]:
return self._client.list_with_relationships(start_time=start_time)
17 changes: 17 additions & 0 deletions libzapi/application/services/wfm/reports_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import Iterable

from libzapi.domain.models.wfm.report import ReportRow
from libzapi.infrastructure.api_clients.wfm import ReportApiClient


class ReportsService:
def __init__(self, client: ReportApiClient) -> None:
self._client = client

def get_data(self, template_id: str, start_time: int, end_time: int) -> Iterable[ReportRow]:
return self._client.get_data(template_id=template_id, start_time=start_time, end_time=end_time)

def get_data_with_relationships(self, template_id: str, start_time: int, end_time: int) -> dict:
return self._client.get_data_with_relationships(
template_id=template_id, start_time=start_time, end_time=end_time
)
29 changes: 29 additions & 0 deletions libzapi/application/services/wfm/shifts_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from __future__ import annotations

from typing import Iterable

from libzapi.application.commands.wfm.shift_cmds import FetchShiftsCmd
from libzapi.domain.models.wfm.shift import Shift
from libzapi.infrastructure.api_clients.wfm import ShiftApiClient


class ShiftsService:
def __init__(self, client: ShiftApiClient) -> None:
self._client = client

def fetch(
self,
start_date: str,
end_date: str,
agent_ids: list[int] | None = None,
published: int | None = None,
page: int = 1,
) -> Iterable[Shift]:
cmd = FetchShiftsCmd(
startDate=start_date,
endDate=end_date,
agentIds=agent_ids,
published=published,
page=page,
)
return self._client.fetch(cmd=cmd)
40 changes: 40 additions & 0 deletions libzapi/application/services/wfm/teams_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from __future__ import annotations

from typing import Iterable

from libzapi.application.commands.wfm.team_cmds import BulkAgentsCmd, CreateTeamCmd, UpdateTeamCmd
from libzapi.domain.models.wfm.team import BulkAgentsResult, Team
from libzapi.infrastructure.api_clients.wfm import TeamApiClient


class TeamsService:
def __init__(self, client: TeamApiClient) -> None:
self._client = client

def list(self, deleted: bool = False) -> Iterable[Team]:
return self._client.list(deleted=deleted)

def get(self, team_id: str) -> Team:
return self._client.get(team_id=team_id)

def create(self, name: str, description: str, manager_id: int, agents_ids: list[str]) -> Team:
cmd = CreateTeamCmd(name=name, description=description, manager_id=manager_id, agents_ids=agents_ids)
return self._client.create(cmd=cmd)

def update(self, team_id: str, **kwargs) -> Team:
cmd = UpdateTeamCmd(**kwargs)
return self._client.update(team_id=team_id, cmd=cmd)

def delete(self, team_id: str) -> None:
self._client.delete(team_id=team_id)

def restore(self, team_id: str) -> Team:
return self._client.restore(team_id=team_id)

def bulk_add_agents(self, agent_ids: list[str], team_ids: list[str]) -> BulkAgentsResult:
cmd = BulkAgentsCmd(agent_ids=agent_ids, team_ids=team_ids)
return self._client.bulk_add_agents(cmd=cmd)

def bulk_remove_agents(self, agent_ids: list[str], team_ids: list[str]) -> BulkAgentsResult:
cmd = BulkAgentsCmd(agent_ids=agent_ids, team_ids=team_ids)
return self._client.bulk_remove_agents(cmd=cmd)
40 changes: 40 additions & 0 deletions libzapi/application/services/wfm/time_off_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from __future__ import annotations

from typing import Iterable

from libzapi.application.commands.wfm.time_off_cmds import ImportTimeOffCmd, ImportTimeOffEntry
from libzapi.domain.models.wfm.time_off import TimeOff, TimeOffImportResult
from libzapi.infrastructure.api_clients.wfm import TimeOffApiClient


class TimeOffService:
def __init__(self, client: TimeOffApiClient) -> None:
self._client = client

def list(
self,
time_off_request_id: str | None = None,
agent_id: int | None = None,
start_time: int | None = None,
end_time: int | None = None,
status: str | None = None,
reason_id: str | None = None,
time_off_type: str | None = None,
page: int | None = None,
per_page: int | None = None,
) -> Iterable[TimeOff]:
return self._client.list(
time_off_request_id=time_off_request_id,
agent_id=agent_id,
start_time=start_time,
end_time=end_time,
status=status,
reason_id=reason_id,
time_off_type=time_off_type,
page=page,
per_page=per_page,
)

def import_time_off(self, entries: list[ImportTimeOffEntry]) -> TimeOffImportResult:
cmd = ImportTimeOffCmd(data=entries)
return self._client.import_time_off(cmd=cmd)
Empty file.
41 changes: 41 additions & 0 deletions libzapi/domain/models/wfm/activity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from dataclasses import dataclass, field

from libzapi.domain.shared_objects.logical_key import LogicalKey


@dataclass(frozen=True, slots=True)
class AgentRef:
id: int
name: str
email: str
deactivated: bool = False
isDeleted: bool = False

Check warning on line 12 in libzapi/domain/models/wfm/activity.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "isDeleted" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTm3JYEkI940qCl&open=AZ0S6iTm3JYEkI940qCl&pullRequest=62


@dataclass(frozen=True, slots=True)
class ActivityTypeRef:
id: str
name: str
color: str = ""
isDeleted: bool = False

Check warning on line 20 in libzapi/domain/models/wfm/activity.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "isDeleted" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTm3JYEkI940qCm&open=AZ0S6iTm3JYEkI940qCm&pullRequest=62


@dataclass(frozen=True, slots=True)
class Activity:
id: str
agentId: int

Check warning on line 26 in libzapi/domain/models/wfm/activity.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "agentId" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTm3JYEkI940qCr&open=AZ0S6iTm3JYEkI940qCr&pullRequest=62
startTime: int

Check warning on line 27 in libzapi/domain/models/wfm/activity.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "startTime" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTm3JYEkI940qCo&open=AZ0S6iTm3JYEkI940qCo&pullRequest=62
type: str
name: str = ""
ticketId: int | None = None

Check warning on line 30 in libzapi/domain/models/wfm/activity.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "ticketId" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTm3JYEkI940qCs&open=AZ0S6iTm3JYEkI940qCs&pullRequest=62
endTime: int | None = None

Check warning on line 31 in libzapi/domain/models/wfm/activity.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "endTime" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTm3JYEkI940qCt&open=AZ0S6iTm3JYEkI940qCt&pullRequest=62
duration: int | None = None
activityTypeIds: list[str] = field(default_factory=list)

Check warning on line 33 in libzapi/domain/models/wfm/activity.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "activityTypeIds" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTm3JYEkI940qCp&open=AZ0S6iTm3JYEkI940qCp&pullRequest=62
eventType: str = ""

Check warning on line 34 in libzapi/domain/models/wfm/activity.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "eventType" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTm3JYEkI940qCu&open=AZ0S6iTm3JYEkI940qCu&pullRequest=62
color: str = ""
isPaid: bool = False

Check warning on line 36 in libzapi/domain/models/wfm/activity.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "isPaid" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTm3JYEkI940qCq&open=AZ0S6iTm3JYEkI940qCq&pullRequest=62
lockIntervals: str | None = None

Check warning on line 37 in libzapi/domain/models/wfm/activity.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "lockIntervals" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTm3JYEkI940qCn&open=AZ0S6iTm3JYEkI940qCn&pullRequest=62

@property
def logical_key(self) -> LogicalKey:
return LogicalKey("wfm_activity", self.id)
27 changes: 27 additions & 0 deletions libzapi/domain/models/wfm/report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from dataclasses import dataclass, field

from libzapi.domain.shared_objects.logical_key import LogicalKey


@dataclass(frozen=True, slots=True)
class Grouping:
key: str
value: str


@dataclass(frozen=True, slots=True)
class Metric:
key: str
value: str
type: str = ""


@dataclass(frozen=True, slots=True)
class ReportRow:
groupings: list[Grouping] = field(default_factory=list)
metrics: list[Metric] = field(default_factory=list)

@property
def logical_key(self) -> LogicalKey:
keys = "_".join(g.value for g in self.groupings)
return LogicalKey("wfm_report_row", keys)
31 changes: 31 additions & 0 deletions libzapi/domain/models/wfm/shift.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from dataclasses import dataclass, field

from libzapi.domain.shared_objects.logical_key import LogicalKey


@dataclass(frozen=True, slots=True)
class ShiftTask:
id: str
startTime: int

Check warning on line 9 in libzapi/domain/models/wfm/shift.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "startTime" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTK3JYEkI940qCg&open=AZ0S6iTK3JYEkI940qCg&pullRequest=62
endTime: int

Check warning on line 10 in libzapi/domain/models/wfm/shift.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "endTime" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTK3JYEkI940qCf&open=AZ0S6iTK3JYEkI940qCf&pullRequest=62
name: str = ""
color: str = ""
taskableId: str = ""

Check warning on line 13 in libzapi/domain/models/wfm/shift.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "taskableId" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTK3JYEkI940qCe&open=AZ0S6iTK3JYEkI940qCe&pullRequest=62
taskableType: str = ""

Check warning on line 14 in libzapi/domain/models/wfm/shift.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "taskableType" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTK3JYEkI940qCd&open=AZ0S6iTK3JYEkI940qCd&pullRequest=62
createdAt: str = ""

Check warning on line 15 in libzapi/domain/models/wfm/shift.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "createdAt" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTK3JYEkI940qCc&open=AZ0S6iTK3JYEkI940qCc&pullRequest=62
note: str = ""


@dataclass(frozen=True, slots=True)
class Shift:
id: str
agentId: int

Check warning on line 22 in libzapi/domain/models/wfm/shift.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "agentId" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTK3JYEkI940qCj&open=AZ0S6iTK3JYEkI940qCj&pullRequest=62
startTime: int

Check warning on line 23 in libzapi/domain/models/wfm/shift.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "startTime" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTK3JYEkI940qCh&open=AZ0S6iTK3JYEkI940qCh&pullRequest=62
endTime: int

Check warning on line 24 in libzapi/domain/models/wfm/shift.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "endTime" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTK3JYEkI940qCk&open=AZ0S6iTK3JYEkI940qCk&pullRequest=62
published: bool = False
parentId: str | int | None = None

Check warning on line 26 in libzapi/domain/models/wfm/shift.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "parentId" to match the regular expression ^[_a-z][_a-z0-9]*$.

See more on https://sonarcloud.io/project/issues?id=BCR-CX_libzapi&issues=AZ0S6iTK3JYEkI940qCi&open=AZ0S6iTK3JYEkI940qCi&pullRequest=62
tasks: list[ShiftTask] = field(default_factory=list)

@property
def logical_key(self) -> LogicalKey:
return LogicalKey("wfm_shift", self.id)
26 changes: 26 additions & 0 deletions libzapi/domain/models/wfm/team.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from dataclasses import dataclass, field

from libzapi.domain.shared_objects.logical_key import LogicalKey


@dataclass(frozen=True, slots=True)
class Team:
id: str
name: str
description: str = ""
manager_id: int | None = None
agents_ids: list[str] = field(default_factory=list)
is_deleted: bool = False
deleted_at: str | None = None
tymeshift_account_id: int | None = None

@property
def logical_key(self) -> LogicalKey:
base = self.name.lower().replace(" ", "_")
return LogicalKey("wfm_team", base)


@dataclass(frozen=True, slots=True)
class BulkAgentsResult:
status: str = ""
affected_teams: list[str] = field(default_factory=list)
Loading
Loading