﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

using AutoMapper;

using Muscularity.Core;
using Muscularity.Features.Authentication.AuthenticateUser;
using Muscularity.Features.Programs.CreateProgram;
using Muscularity.Features.Trainees.SaveProfile;
using Muscularity.Features.Workouts.SaveWorkout;
using Muscularity.Features.Workouts.SaveWorkoutLog;
using Muscularity.Web.Models;

namespace Muscularity.Web
{
    public class AutoMapperWebProfile : Profile
    {
        public AutoMapperWebProfile()
        {
            CreateMapsForAuthenticationController();
            CreateMapsForProgramsController();
            CreateMapsForTraineesController();
            CreateMapsForWorkoutsController();
        }

        private void CreateMapsForAuthenticationController()
        {
            CreateMap<AuthenticationLoginUpdateModel, AuthenticateUserRequest>();
        }

        private void CreateMapsForProgramsController()
        {
            CreateMap<ProgramsCreateProgramUpdateModel, CreateProgramRequest>();
        }

        private void CreateMapsForTraineesController()
        {
            CreateMap<TraineesSaveProfileUpdateModel, SaveProfileRequest>()
                .IgnoreMember(dest => dest.UserAccountId);
        }

        private void CreateMapsForWorkoutsController()
        {
            CreateMap<WorkoutsSaveWorkoutUpdateModel, SaveWorkoutRequest>();
            CreateMap<WorkoutsSaveWorkoutLogUpdateModel, SaveWorkoutLogRequest>()
                .IgnoreMember(dest => dest.WorkoutId);
        }
    }
}
