#pragma once
#include <string>
#include <windows.h>
#include <iostream>
#include <fstream>
#include "dbClass.h"
#include "stringFunctions.h"

/************************************************************************/
/*  This class holds information about a song from the database.        */
/************************************************************************/

using namespace std;
using namespace System;
using namespace System::Data;
using namespace System::Data::OleDb;
using namespace System::Windows::Forms;

ref class song
{
public:
	// Default constructor
	song();
	// Parameterized constructor
	song( int songId );
	// Returns whether there is already a pair in the database of the title and artist type
	static bool songExists( String ^title, String ^artist );
	// Static function that exports the database to XML
	static void exportXML( string *filepath );
	// Static function that adds a song to the database.
	static void addSong( String ^title, String ^artist, String ^filePath );
	// Removes the given song ID row from the DB
	static void removeSong( int songId );
	// Static function that returns the number of songs in the database
	static int totalSongs();
	// Returns the title
	String ^getTitle() { return title; }
	// Returns the artist
	String ^getArtist() { return artist; }
	// Returns the file path
	String ^getFilePath() { return filePath; }
	// Return the ID
	int ^getId() { return id; }
	// Returns the number of times the song has been played
	int ^getPlays() { return plays; }
	// Increments the plays
	void updatePlays();
	// sets the title
	void setTitle( String ^t ) { title = t; }
	// Sets the artist
	void setArtist( String ^a ) { artist = a; }
	// Sets the file path
	void setFilePath( String ^fp ) { filePath = fp; }
	// Sets the id
	void setId( int i ) { id = i; }
private:
	int plays, id;
	String ^title, ^artist, ^filePath;
	dbClass ^db;
};

