package com.example.todolist.entity;

import java.sql.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Version;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "task")
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Task {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id")
	private Integer id;

	@ManyToOne
	@JoinColumn(name = "todo_id")
	private Todo todo;

	@Column(name = "title")
	private String title;

	@Column(name = "deadline")
	private Date deadline;

	@Column(name = "done")
	private String done;

	@Column(name = "assigned_to")
	private Integer assignedTo;
	
	@Column(name = "progress")
	private Integer progress;

	@Column(name = "version") // 追加
	@Version // ①
	private Integer version;

}
