package com.andrezsegovia.api.test.databuilder;

import java.util.Date;

import com.andrezsegovia.api.model.Post;
import com.andrezsegovia.api.model.Subject;
import com.andrezsegovia.api.model.User;

/**
 * Class for build {@link Post} object with all data
 * 
 * @author andrezsegoiva
 *
 */
public class PostDataBuilder {
	
	protected static final String TITLE = "Post For Test";
	protected static final String TAG = "TestTag";
	protected static final String CONTENT = "This is the content for a test post";
	

	private Long postId;
	private User user;
	private Subject subject;
	private String title;
	private String tag;
	private String content;
	private Date createDate;
	private Date updateDate;
	
	public PostDataBuilder() {
		this.title = TITLE;
		this.tag = TAG;
		this.content = CONTENT;
		this.createDate = new Date();
	}
	public PostDataBuilder setPostId(Long postId) {
		this.postId = postId;
		return this;
	}
	public PostDataBuilder withUser(User user) {
		this.user = user;
		return this;
	}
	public PostDataBuilder withSubject(Subject subject) {
		this.subject = subject;
		return this;
	}
	public PostDataBuilder withTitle(String title) {
		this.title = title;
		return this;
	}
	public PostDataBuilder withTag(String tag) {
		this.tag = tag;
		return this;
	}
	public PostDataBuilder withContent(String content) {
		this.content = content;
		return this;
	}
	public PostDataBuilder withCreateDate(Date createDate) {
		this.createDate = createDate;
		return this;
	}
	public PostDataBuilder withUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
		return this;
	}
	public Post build() {
		Post post = new Post();
		post.setPostId(postId);
		post.setUser(user);
		post.setSubject(subject);
		post.setTitle(title);
		post.setContent(content);
		post.setTag(tag);
		post.setCreateDate(createDate);
		post.setUpdateDate(updateDate);
		return post;
	}
	
	

	
}
