// Path: src/main/java/com/mailosaur/models/Server.java
// public class Server {
//     /**
//      * Unique identifier for the server.
//      */
// 	@Key
//     private String id;
// 
//     /**
//      * The name of the server.
//      */
//     @Key
//     private String name;
// 
//     /**
//      * Users (excluding administrators) who have access to the server (if it is restricted).
//      */
//     @Key
//     private List<String> users;
// 
//     /**
//      * The number of messages currently in the server.
//      */
//     @Key
//     private Integer messages;
// 
//     /**
//      * Gets the unique identifier of the server.
//      *
//      * @return The server ID.
//      */
//     public String id() {
//         return this.id;
//     }
// 
//     /**
//      * Gets the name of the server.
//      *
//      * @return The name of the server.
//      */
//     public String name() {
//         return this.name;
//     }
// 
//     /**
//      * Sets the name of the server.
//      *
//      * @param name The name of the server.
//      * @return the Server object itself.
//      */
//     public Server withName(String name) {
//         this.name = name;
//         return this;
//     }
// 
//     /**
//      * Gets the IDs of users who have access to the server (if it is restricted).
//      *
//      * @return The IDs of users who have access to the server (if it is restricted).
//      */
//     public List<String> users() {
//         return this.users;
//     }
// 
//     /**
//      * Sets the IDs of users who have access to the server (if it is restricted).
//      *
//      * @param users The IDs of users who have access to the server (if it is restricted).
//      * @return the Server object itself.
//      */
//     public Server withUsers(List<String> users) {
//         this.users = users;
//         return this;
//     }
// 
//     /**
//      * Gets the number of messages currently in the server.
//      *
//      * @return The number of messages currently in the server.
//      */
//     public Integer messages() {
//         return this.messages;
//     }
// 
// }
// 
// Path: src/main/java/com/mailosaur/models/ServerCreateOptions.java
// public class ServerCreateOptions {
//     /**
//      * A name used to identify the server.
//      */
//     @Key
//     private String name;
// 
//     /**
//      * Sets a name used to identify the server.
//      *
//      * @param name A name used to identify the server.
//      * @return the ServerCreateOptions object itself.
//      */
//     public ServerCreateOptions withName(String name) {
//         this.name = name;
//         return this;
//     }
// 
// }
// 
// Path: src/main/java/com/mailosaur/models/ServerListResult.java
// public class ServerListResult {
//     /**
//      * The individual servers forming the result. Servers
//      * are returned sorted by creation date, with the most recently-created server
//      * appearing first.
//      */
//     @Key
//     private List<Server> items;
// 
//     /**
//      * Gets the individual servers forming the result.
//      *
//      * @return The individual servers forming the result.
//      */
//     public List<Server> items() {
//         return this.items;
//     }
// }


import static org.junit.Assert.*;
import java.io.IOException;
import javax.mail.MessagingException;
import org.junit.BeforeClass;
import org.junit.Test;
import com.mailosaur.models.Server;
import com.mailosaur.models.ServerCreateOptions;
import com.mailosaur.models.ServerListResult;
package com.mailosaur;






public class ServersTest {
	private static MailosaurClient client;
	
	@BeforeClass
    public static void setUpBeforeClass() throws IOException, InterruptedException, MessagingException {
		String apiKey = System.getenv("MAILOSAUR_API_KEY");
		String baseUrl = System.getenv("MAILOSAUR_BASE_URL");

		if (apiKey == null) {
			throw new IOException("Missing necessary environment variables - refer to README.md");
		}

        client = new MailosaurClient(apiKey, baseUrl);
	}
	
	@Test
    public void testList() throws IOException, MailosaurException {
		ServerListResult servers = client.servers().list();
		assertTrue(servers.items().size() > 1);
    }
	
	@Test(expected = MailosaurException.class)
    public void testGetNotFound() throws IOException, MailosaurException {
		client.servers().get("efe907e9-74ed-4113-a3e0-a3d41d914765");
    }
    
    @Test
    public void testCrud() throws IOException, MailosaurException {
    	String serverName = "My test";
    	
    	// Create a new server
    	ServerCreateOptions options = new ServerCreateOptions().withName(serverName);
// Path: src/main/java/com/mailosaur/models/Server.java
// public class Server {
//     /**
//      * Unique identifier for the server.
//      */
// 	@Key
//     private String id;
// 
//     /**
//      * The name of the server.
//      */
//     @Key
//     private String name;
// 
//     /**
//      * Users (excluding administrators) who have access to the server (if it is restricted).
//      */
//     @Key
//     private List<String> users;
// 
//     /**
//      * The number of messages currently in the server.
//      */
//     @Key
//     private Integer messages;
// 
//     /**
//      * Gets the unique identifier of the server.
//      *
//      * @return The server ID.
//      */
//     public String id() {
//         return this.id;
//     }
// 
//     /**
//      * Gets the name of the server.
//      *
//      * @return The name of the server.
//      */
//     public String name() {
//         return this.name;
//     }
// 
//     /**
//      * Sets the name of the server.
//      *
//      * @param name The name of the server.
//      * @return the Server object itself.
//      */
//     public Server withName(String name) {
//         this.name = name;
//         return this;
//     }
// 
//     /**
//      * Gets the IDs of users who have access to the server (if it is restricted).
//      *
//      * @return The IDs of users who have access to the server (if it is restricted).
//      */
//     public List<String> users() {
//         return this.users;
//     }
// 
//     /**
//      * Sets the IDs of users who have access to the server (if it is restricted).
//      *
//      * @param users The IDs of users who have access to the server (if it is restricted).
//      * @return the Server object itself.
//      */
//     public Server withUsers(List<String> users) {
//         this.users = users;
//         return this;
//     }
// 
//     /**
//      * Gets the number of messages currently in the server.
//      *
//      * @return The number of messages currently in the server.
//      */
//     public Integer messages() {
//         return this.messages;
//     }
// 
// }
// 
// Path: src/main/java/com/mailosaur/models/ServerCreateOptions.java
// public class ServerCreateOptions {
//     /**
//      * A name used to identify the server.
//      */
//     @Key
//     private String name;
// 
//     /**
//      * Sets a name used to identify the server.
//      *
//      * @param name A name used to identify the server.
//      * @return the ServerCreateOptions object itself.
//      */
//     public ServerCreateOptions withName(String name) {
//         this.name = name;
//         return this;
//     }
// 
// }
// 
// Path: src/main/java/com/mailosaur/models/ServerListResult.java
// public class ServerListResult {
//     /**
//      * The individual servers forming the result. Servers
//      * are returned sorted by creation date, with the most recently-created server
//      * appearing first.
//      */
//     @Key
//     private List<Server> items;
// 
//     /**
//      * Gets the individual servers forming the result.
//      *
//      * @return The individual servers forming the result.
//      */
//     public List<Server> items() {
//         return this.items;
//     }
// }


// Path: src/test/java/com/mailosaur/ServersTest.java
import static org.junit.Assert.*;
import java.io.IOException;
import javax.mail.MessagingException;
import org.junit.BeforeClass;
import org.junit.Test;
import com.mailosaur.models.Server;
import com.mailosaur.models.ServerCreateOptions;
import com.mailosaur.models.ServerListResult;

package com.mailosaur;






public class ServersTest {
	private static MailosaurClient client;
	
	@BeforeClass
    public static void setUpBeforeClass() throws IOException, InterruptedException, MessagingException {
		String apiKey = System.getenv("MAILOSAUR_API_KEY");
		String baseUrl = System.getenv("MAILOSAUR_BASE_URL");

		if (apiKey == null) {
			throw new IOException("Missing necessary environment variables - refer to README.md");
		}

        client = new MailosaurClient(apiKey, baseUrl);
	}
	
	@Test
    public void testList() throws IOException, MailosaurException {
		ServerListResult servers = client.servers().list();
		assertTrue(servers.items().size() > 1);
    }
	
	@Test(expected = MailosaurException.class)
    public void testGetNotFound() throws IOException, MailosaurException {
		client.servers().get("efe907e9-74ed-4113-a3e0-a3d41d914765");
    }
    
    @Test
    public void testCrud() throws IOException, MailosaurException {
    	String serverName = "My test";
    	
    	// Create a new server
    	ServerCreateOptions options = new ServerCreateOptions().withName(serverName);
    	Server createdServer = client.servers().create(options);