/*
    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    MA 02110-1301  USA.
*/

#include "siweatherstation.h"

using namespace SiWeather::Library;

SiWeatherStation::SiWeatherStation()
{
	init();
}

SiWeatherStation::SiWeatherStation(const QString &uuid, const QString &name)
{
	init();
	setUuid(uuid);
	setName(name);
}

void SiWeatherStation::setUuid(const QString &uuid)
{
	_uuid = QUuid(uuid);
}

QUuid SiWeatherStation::uuid() const
{
	return _uuid;
}

void SiWeatherStation::setName(const QString &name)
{
	_name = name;
}

QString SiWeatherStation::name() const
{
	return _name;
}

void SiWeatherStation::setCity(const QString &city)
{
	_city = city;
}

QString SiWeatherStation::city() const
{
	return _city;
}

void SiWeatherStation::setLongitude(double longitude)
{
	_longitude = longitude;
}

double SiWeatherStation::longitude() const
{
	return _longitude;
}

void SiWeatherStation::setLatitude(double latitude)
{
	_latitude = latitude;
}

double SiWeatherStation::latitude() const
{
	return _latitude;
}

void SiWeatherStation::setType(const QString &type)
{
	_type = type;
}

QString SiWeatherStation::type() const
{
	return _type;
}

void SiWeatherStation::setTypeUrl(const QString &typeUrl)
{
	_typeUrl = QUrl(typeUrl);
}

QUrl SiWeatherStation::typeUrl() const
{
	return _typeUrl;
}

void SiWeatherStation::setEMail(const QString &address)
{
	_eMail = address;
}

QString SiWeatherStation::eMail() const
{
	return _eMail;
}


bool SiWeatherStation::isValidForRegister() const
{
	if(_name.isEmpty())
		return false;
	if(_city.isEmpty())
		return false;
	if(_eMail.isEmpty())
		return false;
	if(_type.isEmpty())
		return false;
	return true;
}

void SiWeatherStation::init()
{
	_longitude = 0;
	_latitude = 0;
}
