"""File containing dataclasses.""" from dataclasses import dataclass from datetime import datetime from moneyhub.constants.constants import StatementAttachmentFileType from moneyhub.constants.constants import StatementAttachmentStatus @dataclass class InternalAttachment: """Internal Statement Attachment dataclass.""" label_type_id_period_id: str file_name: str account_type: str bucket_name: str etag: str event_timestamp: datetime file_key: str file_size: int file_type: StatementAttachmentFileType label_id: int original_file_name: str period_ids: str status: StatementAttachmentStatus upload_date: datetime def __post_init__(self): """Transform internal attachment.""" self.label_id = int(self.label_id) self.file_key = f's3://{self.bucket_name}/{self.file_key}' self.file_type = self.file_type.lower() if len(self.period_ids) != 3: self.period_ids = self.file_name[-4:-1]