import type { GetTeamDetailsOutputDTO } from '@/lib/types/generated/GetTeamDetailsOutputDTO'; export class TeamDetailsViewModel { id: string; name: string; tag: string; description?: string; ownerId: string; leagues: string[]; createdAt?: string; specialization?: string; region?: string; languages?: string[]; membership: { role: string; joinedAt: string; isActive: boolean } | null; private _canManage: boolean; private currentUserId: string; constructor(dto: GetTeamDetailsOutputDTO, currentUserId: string) { this.id = dto.team.id; this.name = dto.team.name; this.tag = dto.team.tag; this.description = dto.team.description; this.ownerId = dto.team.ownerId; this.leagues = dto.team.leagues; this.createdAt = dto.team.createdAt; this.specialization = dto.team.specialization; this.region = dto.team.region; this.languages = dto.team.languages; this.membership = dto.membership; this._canManage = dto.canManage; this.currentUserId = currentUserId; } /** UI-specific: Whether current user is owner */ get isOwner(): boolean { return this.membership?.role === 'owner'; } /** UI-specific: Whether can manage team */ get canManage(): boolean { return this._canManage; } /** UI-specific: Whether current user is member */ get isMember(): boolean { return this.membership !== null; } /** UI-specific: Current user's role */ get userRole(): string { return this.membership?.role || 'none'; } }