# -*- coding: utf-8 -*-
from __future__ import annotations

import datetime
import uuid

from hotpocket_soa.dto.associations import AssociationOut
from hotpocket_soa.dto.saves import ImportedSaveIn, SaveOut

from .base import SaveWorkflow


class ImportSaveWorkflow(SaveWorkflow):
    def run(self,
            *,
            account_uuid: uuid.UUID,
            url: str,
            title: str,
            pk: uuid.UUID,
            created_at: datetime.datetime,
            ) -> tuple[SaveOut, AssociationOut]:
        save = self.create(
            account_uuid,
            ImportedSaveIn(
                url=url,
                title=title,
            ),
        )

        association = self.associate(
            account_uuid,
            save,
            pk=pk,
            created_at=created_at,
        )

        return save, association
