#include <stdio.h>

#define MAX_STRING 50
#define MAX_RACES 10
#define MAX_HORSES 20
#define FRACTIONS 4

// enumerated type for race surface
enum surface
{
    DIRT,
    TURF,
    SYNTHETIC
};

// enumerated type for track condition
enum track_condition
{
    FST, //FAST
    FT, //FAST
    WF, //WET_FAST
    GD, //GOOD
    SL, //SLOW
    MUD, //MUDDY
    MY, //MUDDY
    SY, //SLOPPY
    FIRM, //FIRM
    FRM, //FIRM
    YLD, //YIELDING
    SF, //SOFT
    SFT, //SOFT
    HY, //HEAVY
    HVY //HEAVY
};

// enumerated type for horse gender
enum horse_gender
{
    G, //GELDING
    C, //COLT
    F, //FILLY
    M, //MARE
    R //RIG
};

// enumerated type for race type
enum race_type
{
	MDN, //Maiden special weight
	MSW, //Maiden special weight
	CLM, //Claiming
	ALW, //Allowance
	STA, //Starter Allowance
	STR, //Starter Allowance
	CST, //Claiming Stakes
	MOC, //Maiden Optional Claiming
	INV, //Invitational
	TRL, //Trials
	STK, //Stakes
	MCL, //Maiden Claiming
	OCL, //Allowance Optional Claiming
	AOC, //Allowance Optional Claiming
	HCP, //Handicap
	SHP, //Start Handicap
	SOC, //Starter Optional Claiming
	MST, //Maiden Stakes
	DBY, //Derby
	FTR //Futurity
};

// enumerated type for horse color
enum horse_color
{
	B, //bay
	BL, //black
	BR, //brown
	CH, //chestnut
	GR, //grey
	RO, //roan
	WH //white
};

// enumerated type for distance
enum distance
{
	SPRINT,
	MIDDLE,
	LONG
};

// supporting date structure
struct date
{
    int month; //the month
    int day;	//the day
    int year;	//the year
};

//supporting time structure
struct time
{
    int hour;		//the hour
    int minute;		//the minute
};

//supporting race time structure
struct race_time
{
	int minute;		//minutes
	float second;	//seconds
};


// supporting race performance structure
struct performance
{
    int starts;		//number of starts
    int wins;		//number of wins
    int places;		//number of places
    int shows;		//number of shows
    float earnings;	//total earnings
};

//supporting totals structure
struct totals
{
	struct performance currentYearTotals;	//this years performance
	struct performance previousYearTotals;	//last years performance
	struct performance LifetimeTotals;		//lifetime performance 
	struct performance trackTotals;			//track performance
	struct performance dirtTotals;			//dirt track performance
	struct performance wetDirtTotals;		//wet dirt track performance
	struct performance allWeatherTotals;	//all weather performance
	struct performance atDistanceTotals;	//performance at this distance
};


// supporting jockey structure
struct jockey
{
    char jockeyName[MAX_STRING];	//jockey's name
    float jockeyWeight;		//jockey's weight
    struct performance record;		//jockey's performance record

};

//supporting owner structure
struct owner
{
	char ownerName[MAX_STRING];		//owner's name
	char silks[MAX_STRING];			//silk information
};

//supporting trainer structure
struct trainer
{
	char trainerName[MAX_STRING];	//trainer's name
	struct performance record;		//trainer's performance record
};

//supporting horse structure
struct horse
{
	char horseName[MAX_STRING];        // horse's name
    enum horse_gender horseGender;         // horse's gender
	struct owner horseOwner;			//horse's owner
	struct trainer horseTrainer;		//horse's trainer
	int horseAge;                          // horse's age
	enum horse_color horseColor;		//horse's color
	char sireName[MAX_STRING];        // horse's Sire's name
	char damName[MAX_STRING];        // horse's Dam's name
	int daysUnraced;				//days since the horse last raced
	struct totals raceTotals;		//horse's performance records
	int lastSpeedFigure;		// horse’s last Official Equibase® Speed Figure
};

//supporting race condition structure
struct race_condition
{
	int purse;		//prize money of the race
	char raceDescription[MAX_STRING];		//detailed description of the race
	int ageRestriction;		//age rextriction
	int weightAssignment;	//weight assignment
	char claimingCondition[MAX_STRING];	//claim condition
	int raceDistance;		//distance of the race
	
};

//supporting track record holder structure
struct track_record_holder
{
	char horseName[MAX_STRING];        // horse name
	int horseAge;                          // horse age at time of race
	float weightCarried;                   // weight carried by horse at time of recored
	struct race_time recordTime;				//record time
	struct performance record;        // past performance record
};

//supporting struct for claiming information
struct claiming_information
{
	char newOwnerName[MAX_STRING];		//name of the new owner
	char previousOwnerName[MAX_STRING];		//name of the previous owner
	char formerTrainerName[MAX_STRING];		//name of the trainer
	float claimingPrice;				//price for claiming
};

// structure to store details on each race
struct race_details
{
    struct date raceDate;          //date of the race
    struct time raceTime;			//time of the race
    char wagersAvailable[MAX_STRING];	//shows the type of wager you can use to bet in that specific race including the exotic bets
    int raceNumber;                        //race number
    char trackName[MAX_STRING];       	  // track name
    int raceRating;						  //estimate of what the winner of today’s race will earn for an Equibase Speed Figure 
    enum race_type raceType;			  // what type of race is the event about
    enum surface raceSurface;             // dirt, turf, synthetic
    enum track_condition condition;        // track condition
	struct race_condition raceCondition;   //includes the purse, detailed description of the race, age restriction/condition, weight assignments, claiming condition and distance of the race.
    struct track_record_holder trackRecord; //contains the track record holder information including the horse’s name, his age, the weight carried and the time and the horse’s race record (wins, places, shows).This will reflect the record on the same surface at the same distance by the same breed type.

};

// add a structure to store details on each horse
struct horse_details_and_past_performance
{
    int programNumber;                     // program number
    char saddleClothColor[MAX_STRING];		//saddle color
    float morningLineOdds;           // morning line odds
	struct horse raceHorse;			//horse information 
	char medicationAndEquipment[MAX_STRING];	 //indicates the types of medication and equipment the horse will be using. Medication will always be listed with a capital letter
    float weightCarried;                   // assigned weight
    struct jockey horseJockey;             // jockey information
	int horseClassFigure;		//estimate of what that starter will earn for an Equibase Speed Figure (Thoroughbred) or speed rating (Quarter Horse and Arabian) in today’s race
	char trackCode[3];		//racetrack's acronym
	int raceNumber;		//sequence of the race within the day
	enum track_condition trackCondition;	//track condition
	enum surface trackSurface;             // dirt, turf, synthetic
	enum distance raceDistance;			//type of race sprint, middle, or long distance
	struct race_time fractionalTimes[FRACTIONS];	//times recorded at specific points or “fractions” of the race.
	enum race_type raceType;			  // what type of race is the event about
	int paceFigure;		//the horse’s “speed figure” at the first call of the race
	int postPosition;	//the actual physical position of the horse in the racetrack
	int finalPosition;	//Final Position of the horse during each past race
	float finalOdds;	//the win odds for the horse at the start time of the race
	char topThreeFinishers[MAX_STRING];		//the first three finishers of the race, followed by the weight that horse carried and then followed by margin
	char shortFootnotes[MAX_STRING];		//the chart comments listed for that horse in that race
	struct claiming_information claimInfo;	//shows the new owner name, previous owner name, for a claiming price – Former Trainer
	char workoutLines[MAX_STRING];		//shows an insight into a horse’s fitness, conditioning, and readiness for upcoming races
	int ageRestriction;		//age restriction
	char fillieRestricted;	//Y/N  means the specific race was restricted to fillies
	char stateBredRestricted;	//Y/N meaning the specific race was restricted only to state bred horses
	int fieldSize;		// the number of horses starting in the race
	
	
};

// **************************************************
// Function: main
//
// Description: declares arrays of race and horse
//              structures to test that the code compiles
//
// Parameters: none
//
// Returns: 0
//
// **************************************************

int main()
{
    // NOTE: You do not have to populate these
    struct race_details myRaces[MAX_RACES];
    struct horse_details_and_past_performance myHorses[MAX_HORSES];

    return 0;
}
