/**********************************************************************
 * LeechCraft - modular cross-platform feature rich internet client.
 * Copyright (C) 2006-2014  Georg Rudoy
 *
 * Boost Software License - Version 1.0 - August 17th, 2003
 *
 * Permission is hereby granted, free of charge, to any person or organization
 * obtaining a copy of the software and accompanying documentation covered by
 * this license (the "Software") to use, reproduce, display, distribute,
 * execute, and transmit the Software, and to prepare derivative works of the
 * Software, and to permit third-parties to whom the Software is furnished to
 * do so, all subject to the following:
 *
 * The copyright notices in the Software and this entire statement, including
 * the above license grant, this restriction and the following disclaimer,
 * must be included in all copies of the Software, in whole or in part, and
 * all derivative works of the Software, unless such copies or derivative
 * works are solely in the form of machine-executable object code generated by
 * a source language processor.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
 * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
 * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 **********************************************************************/

#include "stdanfields.h"
#include <QMap>
#include <QList>
#include <interfaces/an/ianemitter.h>
#include <interfaces/an/constants.h>

namespace LC
{
namespace Util
{
	QList<ANFieldData> GetStdANFields (const QString& type)
	{
		static const QMap<QString, QList<ANFieldData>> values
		{
			{
				AN::TypeIMEventTuneChange,
				{
					{
						AN::Field::MediaTitle,
						QObject::tr ("Title metadata"),
						QObject::tr ("Title of the track being played."),
						QVariant::String,
						{
							AN::TypeIMEventTuneChange
						}
					},
					{
						AN::Field::MediaAlbum,
						QObject::tr ("Album metadata"),
						QObject::tr ("Album of the track being played."),
						QVariant::String,
						{
							AN::TypeIMEventTuneChange
						}
					},
					{
						AN::Field::MediaArtist,
						QObject::tr ("Artist metadata"),
						QObject::tr ("Artist of the track being played."),
						QVariant::String,
						{
							AN::TypeIMEventTuneChange
						}
					},
					{
						AN::Field::MediaLength,
						QObject::tr ("Length metadata"),
						QObject::tr ("Length of the track being played."),
						QVariant::Int,
						{
							AN::TypeIMEventTuneChange
						}
					}
				}
			},
			{
				AN::TypeIMEventActivityChange,
				{
					{
						AN::Field::IMActivityGeneral,
						QObject::tr ("General activity"),
						QObject::tr ("General activity of the contact."),
						QVariant::String,
						{
							AN::TypeIMEventActivityChange
						}
					},
					{
						AN::Field::IMActivitySpecific,
						QObject::tr ("Specific activity"),
						QObject::tr ("Specific activity of the contact within the given general activity."),
						QVariant::String,
						{
							AN::TypeIMEventActivityChange
						}
					},
					{
						AN::Field::IMActivityText,
						QObject::tr ("Activity text"),
						QObject::tr ("The comment set by the contact."),
						QVariant::String,
						{
							AN::TypeIMEventActivityChange
						}
					}
				}
			},
			{
				AN::TypeIMEventMoodChange,
				{
					{
						AN::Field::IMMoodGeneral,
						QObject::tr ("Mood"),
						QObject::tr ("The mood of the contact."),
						QVariant::String,
						{
							AN::TypeIMEventMoodChange
						}
					},
					{
						AN::Field::IMMoodText,
						QObject::tr ("Mood explanation text"),
						QObject::tr ("The text accompanying the mood set by the contact."),
						QVariant::String,
						{
							AN::TypeIMEventMoodChange
						}
					}
				}
			},
			{
				AN::TypeIMEventLocationChange,
				{
					{
						AN::Field::IMLocationLatitude,
						QObject::tr ("Latitude"),
						QObject::tr ("The latitude of the contact's current position."),
						QVariant::Double,
						{
							AN::TypeIMEventLocationChange
						}
					},
					{
						AN::Field::IMLocationLongitude,
						QObject::tr ("Longitude"),
						QObject::tr ("The longitude of the contact's current position."),
						QVariant::Double,
						{
							AN::TypeIMEventLocationChange
						}
					},
					{
						AN::Field::IMLocationCountry,
						QObject::tr ("Country"),
						QObject::tr ("The country the contact is currently in."),
						QVariant::String,
						{
							AN::TypeIMEventLocationChange
						}
					},
					{
						AN::Field::IMLocationLocality,
						QObject::tr ("Longitude"),
						QObject::tr ("The the exact locality (like a city or a town) the contact is currently in."),
						QVariant::String,
						{
							AN::TypeIMEventLocationChange
						}
					}
				}
			},
			{
				AN::CatMediaPlayer,
				{
					{
						AN::Field::MediaPlayerURL,
						QObject::tr ("File URL"),
						QObject::tr ("URL to the file being played."),
						QVariant::Url,
						{
							AN::TypeMediaPlaybackStatus
						}
					},
					{
						AN::Field::MediaPlaybackStatus,
						QObject::tr ("Playback status"),
						QObject::tr ("The status of the currently playing media file."),
						QVariant::String,
						{
							AN::TypeMediaPlaybackStatus
						},
						{
							"Stopped",
							"Paused",
							"Playing"
						}
					},
					{
						AN::Field::MediaTitle,
						QObject::tr ("Title metadata"),
						QObject::tr ("Title of the track being played."),
						QVariant::String,
						{
							AN::TypeMediaPlaybackStatus
						}
					},
					{
						AN::Field::MediaAlbum,
						QObject::tr ("Album metadata"),
						QObject::tr ("Album of the track being played."),
						QVariant::String,
						{
							AN::TypeMediaPlaybackStatus
						}
					},
					{
						AN::Field::MediaArtist,
						QObject::tr ("Artist metadata"),
						QObject::tr ("Artist of the track being played."),
						QVariant::String,
						{
							AN::TypeMediaPlaybackStatus
						}
					},
					{
						AN::Field::MediaLength,
						QObject::tr ("Length metadata"),
						QObject::tr ("Length of the track being played."),
						QVariant::Int,
						{
							AN::TypeMediaPlaybackStatus
						}
					}
				}
			},
			{
				AN::CatNews,
				{
					{
						AN::Field::NewsSourceName,
						QObject::tr ("News source name"),
						QObject::tr ("The name of the news source that caused the notification."),
						QVariant::String,
						{
							AN::TypeNewsSourceBroken,
							AN::TypeNewsSourceUpdated
						}
					}
				}
			},
			{
				AN::CatTerminal,
				{
					{
						AN::Field::TerminalActive,
						QObject::tr ("Terminal is active"),
						QObject::tr ("The terminal tab that caused the notification is active."),
						QVariant::Bool,
						{
							AN::TypeTerminalBell,
							AN::TypeTerminalActivity,
							AN::TypeTerminalInactivity
						}
					}
				}
			}
		};

		if (!type.isEmpty ())
			return values.value (type);

		QList<ANFieldData> result;
		for (const auto& list : values)
			result << list;
		return result;
	}
}
}
