import { BaseEntity } from "./base";
import { ActivityDto, ActivityCreateDto, ActivityUpdateDto } from "./dto";
import { UserId, ActivityId } from "./value-ids";

export type Activity = Omit<ActivityDto, "id" | "createdAt" | "updatedAt" | "lastEditorID"> & {
    id: ActivityId;
} & BaseEntity;

export const mapActivityDtoToActivity = (dto: ActivityDto): Activity => ({
    ...dto,
    id: dto.id as ActivityId,
    createdAt: new Date(dto.createdAt),
    updatedAt: new Date(dto.updatedAt),
    lastEditorID: dto.lastEditorID as UserId,
});

export type ActivityCreate = ActivityCreateDto;

export const mapActivityCreateDtoToActivityCreate = (dto: ActivityCreateDto): ActivityCreate => ({
    ...dto,
});

export type ActivityUpdate = ActivityUpdateDto;

export const mapActivityUpdateDtoToActivityUpdate = (dto: ActivityUpdateDto): ActivityUpdate => ({
    ...dto,
});
