#pragma once

#include "gosFX.hpp"
#include "Card.hpp"
#include <MLR\MLR.hpp>

namespace MidLevelRenderer {class MLRCardCloud;}

namespace gosFX
{
	//############################################################################
	//########################  Flare__Specification  #############################
	//############################################################################

	class Flare;

	class Flare__Specification:
		public Card__Specification
	{
		friend class Flare;

	//----------------------------------------------------------------------
	// Constructors/Destructors
	//
	protected:
		Flare__Specification(
			Stuff::MemoryStream *stream,
			int gfx_version
		);

	public:
		typedef Card__Specification BaseClass;

		Flare__Specification();
		~Flare__Specification();

		void
			Save(Stuff::MemoryStream *stream);

		void 
			BuildDefaults();
	

		bool 
			IsDataValid(bool fix_data=false);


		static Flare__Specification*
			Make(
				Stuff::MemoryStream *stream,
				int gfx_version
			);

		void
			Copy(Flare__Specification *spec);

		Stuff::Scalar
			m_fadeInRate,
			m_fadeOutRate,
			m_rayCastTime;
	};

	//############################################################################
	//#############################  Flare  #################################
	//############################################################################

	class Flare:
		public Card
	{
	//----------------------------------------------------------------------------
	// Class Registration Support
	//
	public:
		static void InitializeClass();
		static void	TerminateClass();

		typedef Flare__Specification Specification;
		typedef Card BaseClass;

	//----------------------------------------------------------------------------
	// Class Data Support
	//
	protected:
		Flare(
			Specification *spec,
			unsigned flags
		);
		~Flare();

		Stuff::Scalar
			m_fadeLevel,
			m_fadeTarget,
			m_timeTillCast;

	public:
		static Flare*
			Make(
				Specification *spec,
				unsigned flags
			);

		Specification*
			GetSpecification()
				{
					Check_Object(this);
					return
						Cast_Object(Specification*, m_specification);
				}

		static ClassData
			*DefaultData;

		typedef bool (*RayCastMethod)(Stuff::Line3D *line);
		static RayCastMethod RayCaster;

	//----------------------------------------------------------------------------
	// Testing
	//
	public:
		void
			TestInstance() const;

	//----------------------------------------------------------------------------
	// API
	//
	public:
		void
			Start(ExecuteInfo *info);
		bool
			Execute(ExecuteInfo *info);
		void
			Draw(DrawInfo *info);
		void
			Kill();
	};

}
