import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class StorageService {
  saveToken(token: string): void {
    localStorage.setItem('accessToken', token);
  }

  getToken(): string | null {
    return localStorage.getItem('accessToken');
  }

  clearToken(): void {
    localStorage.removeItem('accessToken');
  }

  saveUserData(fullName: string | null, avatar: string | null): void {
    localStorage.setItem('userFullName', fullName || '');
    localStorage.setItem('avatar', avatar || '');
  }

  getUserFullName(): string | null {
    return localStorage.getItem('userFullName');
  }

  getAvatar(): string | null {
    return localStorage.getItem('avatar');
  }

  clearUserData(): void {
    localStorage.removeItem('userFullName');
    localStorage.removeItem('avatar');
  }
}
