import { TeamJoinRequestItemDto } from '../dtos';

export class TeamJoinRequestViewModel implements TeamJoinRequestItemDto {
  id: string;
  teamId: string;
  driverId: string;
  requestedAt: string;
  message?: string;

  private currentUserId: string;
  private isOwner: boolean;

  constructor(dto: TeamJoinRequestItemDto, currentUserId: string, isOwner: boolean) {
    Object.assign(this, dto);
    this.currentUserId = currentUserId;
    this.isOwner = isOwner;
  }

  /** UI-specific: Whether current user can approve */
  get canApprove(): boolean {
    return this.isOwner;
  }

  /** UI-specific: Formatted requested date */
  get formattedRequestedAt(): string {
    return new Date(this.requestedAt).toLocaleString();
  }

  /** UI-specific: Request status (pending) */
  get status(): string {
    return 'Pending';
  }

  /** UI-specific: Status color */
  get statusColor(): string {
    return 'yellow';
  }

  /** UI-specific: Approve button text */
  get approveButtonText(): string {
    return 'Approve';
  }

  /** UI-specific: Reject button text */
  get rejectButtonText(): string {
    return 'Reject';
  }
}