import { Injectable } from '@nestjs/common';
import { StoreBackupShareCommand } from '../commands/store-backup-share/store-backup-share.command';
import { StoreBackupShareHandler, StoreBackupShareResult } from '../commands/store-backup-share/store-backup-share.handler';
import { RevokeShareCommand } from '../commands/revoke-share/revoke-share.command';
import { RevokeShareHandler } from '../commands/revoke-share/revoke-share.handler';
import { GetBackupShareQuery } from '../queries/get-backup-share/get-backup-share.query';
import { GetBackupShareHandler, BackupShareDto } from '../queries/get-backup-share/get-backup-share.handler';

@Injectable()
export class BackupShareApplicationService {
  constructor(
    private readonly storeHandler: StoreBackupShareHandler,
    private readonly revokeHandler: RevokeShareHandler,
    private readonly getHandler: GetBackupShareHandler,
  ) {}

  async storeBackupShare(command: StoreBackupShareCommand): Promise<StoreBackupShareResult> {
    return this.storeHandler.execute(command);
  }

  async revokeShare(command: RevokeShareCommand): Promise<void> {
    return this.revokeHandler.execute(command);
  }

  async getBackupShare(query: GetBackupShareQuery): Promise<BackupShareDto> {
    return this.getHandler.execute(query);
  }
}
