<script lang="ts">

    export type Attachment = {
        url: string;
    }
    export type WorkoutItem = {
        id: string;
        name: string;
        created_by: string;
        created_at: string;
        updated_at: string;
        description: string;
        cadence: number;
        heart_rate: number;
        max_cadence: number;
        max_heart_rate: number;
        temperature: number;
        speed: number;
        power: number;
        max_speed: number;
        max_power: number;
        duraion_sec: number;
        distantion: number;
        attachment: Attachment;
        latitude: number;
        longitude: number;
    }
    export const secondsToDuration = (seconds: number) =>  {
        let hours = Math.floor(seconds / 3600);
        let minutes = Math.floor((seconds % 3600) / 60);
        return `${hours} ч. ${minutes} мин.`;
    }

    export const distConvert = (speed: number) => {
      return Math.round(speed/1000)
    }

    export const speedConvert = (speed: number) => {
      return Math.round(speed*3.6)
    }
    export default {}
</script>