// Path: src/main/java/com/lyubenblagoev/postfixrest/entity/Account.java
// @Entity
// @Table(name = "accounts")
// public class Account extends BaseEntity {
// 	
// 	@ManyToOne(fetch = FetchType.LAZY)
// 	@JoinColumn(name = "domain_id")
// 	private Domain domain;
// 
// 	private String username;
// 	private String password;
// 	
// 	public Domain getDomain() {
// 		return domain;
// 	}
// 
// 	public void setDomain(Domain domain) {
// 		this.domain = domain;
// 	}
// 
// 	public String getUsername() {
// 		return username;
// 	}
// 
// 	public void setUsername(String email) {
// 		this.username = email;
// 	}
// 
// 	public String getPassword() {
// 		return password;
// 	}
// 
// 	public void setPassword(String password) {
// 		this.password = password;
// 	}
// 
// }
// 
// Path: src/main/java/com/lyubenblagoev/postfixrest/entity/Bcc.java
// @MappedSuperclass
// public class Bcc extends BaseEntity {
// 
// 	@ManyToOne(fetch = FetchType.LAZY)
// 	@JoinColumn(name = "account_id")
// 	private Account account;
// 	private String receiverEmailAddress;
// 
// 	public Bcc() {
// 		super();
// 	}
// 
// 	public Account getAccount() {
// 		return account;
// 	}
// 
// 	public void setAccount(Account account) {
// 		this.account = account;
// 	}
// 
// 	public String getReceiverEmailAddress() {
// 		return receiverEmailAddress;
// 	}
// 
// 	public void setReceiverEmailAddress(String receiverEmailAddress) {
// 		this.receiverEmailAddress = receiverEmailAddress;
// 	}
// 
// }


import java.util.Date;
import javax.validation.constraints.Email;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lyubenblagoev.postfixrest.entity.Account;
import com.lyubenblagoev.postfixrest.entity.Bcc;
package com.lyubenblagoev.postfixrest.service.model;




public class BccResource {

	private Long id;
	
	private Long accountId;
	
	@Email private String email;
	private boolean enabled;
	
	@JsonFormat(pattern="yyyy-MM-dd'T'HH:mm:ssZ")
	private Date created;
	
	@JsonFormat(pattern="yyyy-MM-dd'T'HH:mm:ssZ")
	private Date updated;
	
	public static BccResource fromBcc(Bcc bcc) {
		BccResource result = new BccResource();
		result.setId(bcc.getId());
		result.setAccountId(bcc.getAccount().getId());
		result.setEmail(bcc.getReceiverEmailAddress());
		result.setEnabled(bcc.isEnabled());
		result.setCreated(bcc.getCreated());
		result.setUpdated(bcc.getUpdated());
		return result;
	}
	
// Path: src/main/java/com/lyubenblagoev/postfixrest/entity/Account.java
// @Entity
// @Table(name = "accounts")
// public class Account extends BaseEntity {
// 	
// 	@ManyToOne(fetch = FetchType.LAZY)
// 	@JoinColumn(name = "domain_id")
// 	private Domain domain;
// 
// 	private String username;
// 	private String password;
// 	
// 	public Domain getDomain() {
// 		return domain;
// 	}
// 
// 	public void setDomain(Domain domain) {
// 		this.domain = domain;
// 	}
// 
// 	public String getUsername() {
// 		return username;
// 	}
// 
// 	public void setUsername(String email) {
// 		this.username = email;
// 	}
// 
// 	public String getPassword() {
// 		return password;
// 	}
// 
// 	public void setPassword(String password) {
// 		this.password = password;
// 	}
// 
// }
// 
// Path: src/main/java/com/lyubenblagoev/postfixrest/entity/Bcc.java
// @MappedSuperclass
// public class Bcc extends BaseEntity {
// 
// 	@ManyToOne(fetch = FetchType.LAZY)
// 	@JoinColumn(name = "account_id")
// 	private Account account;
// 	private String receiverEmailAddress;
// 
// 	public Bcc() {
// 		super();
// 	}
// 
// 	public Account getAccount() {
// 		return account;
// 	}
// 
// 	public void setAccount(Account account) {
// 		this.account = account;
// 	}
// 
// 	public String getReceiverEmailAddress() {
// 		return receiverEmailAddress;
// 	}
// 
// 	public void setReceiverEmailAddress(String receiverEmailAddress) {
// 		this.receiverEmailAddress = receiverEmailAddress;
// 	}
// 
// }


// Path: src/main/java/com/lyubenblagoev/postfixrest/service/model/BccResource.java
import java.util.Date;
import javax.validation.constraints.Email;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lyubenblagoev.postfixrest.entity.Account;
import com.lyubenblagoev.postfixrest.entity.Bcc;

package com.lyubenblagoev.postfixrest.service.model;




public class BccResource {

	private Long id;
	
	private Long accountId;
	
	@Email private String email;
	private boolean enabled;
	
	@JsonFormat(pattern="yyyy-MM-dd'T'HH:mm:ssZ")
	private Date created;
	
	@JsonFormat(pattern="yyyy-MM-dd'T'HH:mm:ssZ")
	private Date updated;
	
	public static BccResource fromBcc(Bcc bcc) {
		BccResource result = new BccResource();
		result.setId(bcc.getId());
		result.setAccountId(bcc.getAccount().getId());
		result.setEmail(bcc.getReceiverEmailAddress());
		result.setEnabled(bcc.isEnabled());
		result.setCreated(bcc.getCreated());
		result.setUpdated(bcc.getUpdated());
		return result;
	}
	
	public static Bcc toBcc(BccResource bcc, Account account) {