package de.ihrig.fwla.display.configuration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import de.ihrig.fwla.display.api.HomeCoordinate;
import lombok.Getter;

@Configuration
@EnableConfigurationProperties(HomeProperties.class)
public class HomeConfiguration {

	private final HomeProperties homeProperties;

	@Autowired
	public HomeConfiguration(HomeProperties homeProperties) {
		this.homeProperties = homeProperties;
	}

	@Bean
	public HomeCoordinate homeCoordinate() {
		return new HomeCoordinate() {

			@Getter
			private final double latitude = homeProperties.getLatitude();
			@Getter
			private final double longitude = homeProperties.getLongitude();
		};
	}
}
