import { Injectable } from '@angular/core';
import { SessionStorageService } from './session-storage.service';

export interface ScrollPosition {
  top?: number;
  left?: number;
}

@Injectable({ providedIn: 'root' })
export class ScrollPositionService {
  constructor(private storageService: SessionStorageService) {}

  getPosition(key: string): ScrollPosition {
    return this.storageService.get(key);
  }

  setPosition(key: string, position: ScrollPosition): void {
    this.storageService.set(key, position);
  }

  deletePosition(key: string): void {
    this.storageService.delete(key);
  }
}
