package com.realnet.DataLake.Controllers;

import javax.xml.bind.annotation.XmlRootElement;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
@RequestMapping("/token/api")
public class XmlApiExample {

	@GetMapping(value = "/getUser", produces = MediaType.APPLICATION_XML_VALUE)
	public User getUser() {
		User user = new User();
		user.setId(101);
		user.setName("John Doe");
		user.setEmail("john.doe@example.com");
		return user;
	}

	// Dummy XML model class
	@XmlRootElement(name = "user")
	public static class User {
		private int id;
		private String name;
		private String email;

		// Getters and setters
		public int getId() {
			return id;
		}

		public void setId(int id) {
			this.id = id;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public String getEmail() {
			return email;
		}

		public void setEmail(String email) {
			this.email = email;
		}
	}
}
