/* 


 */


#include "defs.h"
int i;

// initializes the array of exercises
// inputs:  the size of the array, the array, and file pointer
// output:  none
void initArray(int arraySize, exercise workout[], FILE *inFile) {
	for (i = 0; i < arraySize; i++){
		fscanf(inFile, "%s", workout[i].name);
		fscanf(inFile, "%s", workout[i].muscles);
		workout[i].weight = 0;
		workout[i].time = 0;
		workout[i].sets = 0;
		workout[i].reps = 0;
	}
}










// prints the array
// inputs:  the size of the array and the array
// output:  none
void printArray(int arraySize, exercise workout[]) {
	int i;
	printf("\n%-25s %-36s %5s %5s %5s %5s\n", 
			"EXERCISE", "MUSCLES", "WEIGHT",
			"TIME", "SETS", "REPS");
	for (i = 0; i < arraySize; i++) {
		printf("%2d. %-21s %-35s %5d %5d %5d %5d\n", 
				i+1,
				workout[i].name,
				workout[i].muscles,
				workout[i].weight,
				workout[i].time,
				workout[i].sets,
				workout[i].reps);
	}
	printf("\n");
}


// fills in the array with the values from the user to create
//		their workout plan
// note the call to freopen which sets the stdin back to the terminal
// inputs:  the size of the array and the array
// output:  none
void getWorkout(int arraySize, exercise workout[]) {
	for (i = 0; i < 11; i++){
		printf("%s for %s:\n", workout[i].name, workout[i]. muscles);
		//	if ( i <= 3 || i == 7 || i == 8 || i == 9){
		if (strcmp(workout[i].name, "bench_press") == 0 || strcmp(workout[i].name, "squat") == 0
				|| strcmp(workout[i].name, "dead_lift") == 0 ||  strcmp(workout[i].name, "dead_lift") == 0
				|| strcmp(workout[i].name, "power_clean") == 0 || strcmp(workout[i].name, "bicep_curls") == 0
				|| strcmp(workout[i].name, "tricep_pulldowns") == 0 || strcmp(workout[i].name, "tricep_kickbacks") == 0) {
			printf("Weight: ");
			scanf("%d", &workout[i].weight);
			printf("\n");
			printf("Sets: ");
			scanf("%d", &workout[i].sets);
			printf("\n");
			printf("Reps: ");
			scanf("%d", &workout[i].reps);
			printf("\n");
		}
		//	else if ( i == 4 || i == 5){
		else if	(strcmp(workout[i].name, "hip_thrust") == 0
				|| strcmp(workout[i].name, "russian_twists") == 0){
			printf("Weight: ");
			scanf("%d", &workout[i].weight);
			printf("\n");
			printf("Time: ");
			scanf("%d", &workout[i].time);
			printf("\n");
			printf("Sets: ");
			scanf("%d", &workout[i].sets);
			printf("\n");
			printf("Reps: ");
			scanf("%d", &workout[i].reps);
			printf("\n");
		}
		//	else{
		else if (strcmp(workout[i].name, "leg_raises") == 0
				|| strcmp(workout[i].name, "situps/crunches") == 0){
			printf("Time: ");
			scanf("%d", &workout[i].time);
			printf("\n");
			printf("Sets: ");
			scanf("%d", &workout[i].sets);
			printf("\n");
			printf("Reps: ");
			scanf("%d", &workout[i].reps);
			printf("\n");
		}
	}
}
