package org.codiki.core.entities.dto;

import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;

import org.codiki.core.entities.persistence.Category;

public class CategoryDTO {
	private Long id;
	
	private String name;
	
	private List<CategoryDTO> listSubCategories;

	public CategoryDTO() {
		super();
		listSubCategories = new LinkedList<>();
	}
	
	public CategoryDTO(final Category pCategory) {
		this();
		id = pCategory.getId();
		name = pCategory.getName();
		listSubCategories = pCategory.getListSubCategories().stream().map(CategoryDTO::new)
				.collect(Collectors.toList());
	}
	
	public Long getId() {
		return id;
	}

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

	public String getName() {
		return name;
	}

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

	public List<CategoryDTO> getListSubCategories() {
		return listSubCategories;
	}

	public void setListSubCategories(List<CategoryDTO> listSubCategories) {
		this.listSubCategories = listSubCategories;
	}
}
