import shutil
from typing import Sequence

from clarabot_nano.server.fstx.filesystem.operation.base import AbstractIOQueueOperation


class RenameOperation(AbstractIOQueueOperation):
    OPERATION_KEY = "REN"

    def __init__(self, account_id: int, src: str, dst: str):
        AbstractIOQueueOperation.__init__(self, account_id)
        self.src = src
        self.dst = dst

    def paths(self) -> Sequence[str]:
        return (self.src, self.dst)

    def execute(self):
        shutil.move(self.src, self.dst)
