import { ActivityRouteEntity } from "../../../activity/domain/entities/activity_info_entity";
import { ActivityRouteModel } from "../model/route_activity_model";

export const activityRouteModelToActivityRouteEntity = (activity: ActivityRouteModel): ActivityRouteEntity => {
    const startTime = new Date(activity.openAt);
    startTime.setHours(activity.openAt);
    const endTime = new Date(activity.closeAt);
    endTime.setHours(activity.closeAt);
    return {
        id: 1, // TODO: Implement this
        name: activity.name,
        imageUri: activity.imageName,
        description: activity.description,
        townId: activity.idTown,
        location: activity.address,
        coordinates: {
            latitude: parseFloat(activity.latitude),
            longitude: parseFloat(activity.longitude),
        },
        tags: activity.categories.map((category) => category.name),
        startTime: startTime,
        endTime: endTime,
        done: false,
    }
};