package com.google.sps.data;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.Entity;
import com.google.sps.service.DatabaseService;
import java.util.Date;

public abstract class Lesson {

    public static final String LESSON_ENTITY_NAME = "Lesson";
    public static final String ISDRAFT_PROPERTY_KEY = "isDraft";
    public static final String TITLE_PROPERTY_KEY = "title";
    public static final String DESCRIPTION_PROPERTY_KEY = "description";
    // public static final String TAGS_PROPERTY_KEY = "tags";
    public static final String DATE_PROPERTY_KEY = "date";

    private Entity delegate;

    public Lesson(Entity delegate) {
        this.delegate = delegate;
    }

    public Lesson(String title, String description) {
        this.delegate = new Entity(Lesson.LESSON_ENTITY_NAME);
        this.delegate.setProperty(Lesson.ISDRAFT_PROPERTY_KEY, false);
        this.delegate.setProperty(User.NICKNAME_PROPERTY_KEY, title);
        this.delegate.setProperty(User.USER_ID_PROPERTY_KEY, description);
    }

}
@@ -625,24 +625,22 @@
  Entity 
-delegate
+entity
 ;%0A%0A    p
@@ -659,24 +659,22 @@
 (Entity 
-delegate
+entity
 ) %7B%0A    
@@ -686,27 +686,23 @@
 his.
-delegate = delegate
+entity = entity
 ;%0A  
@@ -773,24 +773,22 @@
    this.
-delegate
+entity
  = new E
@@ -830,32 +830,30 @@
        this.
-delegate
+entity
 .setProperty
@@ -907,69 +907,618 @@
 his.
-delegate.setProperty(User.NICKNAME_PROPERTY_KEY, titl
+entity.setProperty(Lesson.TITLE_PROPERTY_KEY, title);%0A        this.entity.setProperty(Lesson.DESCRIPTION_PROPERTY_KEY, description);%0A        this.entity.setProperty(Lesson.DATE_PROPERTY_KEY, new Date());%0A    %7D%0A%0A    public Entity getLessonEntity() %7B%0A        return this.entity;%0A    %7D%0A%0A    public boolean getIsDraft() %7B%0A        return (boolean) this.entity.getProperty(Lesson.ISDRAFT_PROPERTY_KEY);%0A    %7D%0A%0A    public void publish() %7B%0A        this.entity.setProperty(Lesson.ISDRAFT_PROPERTY_KEY, true);%0A    %7D%0A%0A    public void unpublish() %7B%0A        this.entity.setProperty(Lesson.ISDRAFT_PROPERTY_KEY, fals
 e);%0A    
     
@@ -1517,50 +1517,469 @@
     
+%7D%0A%0A
     
-this.delegate.setProperty(User.USER_ID
+public String getTitle() %7B%0A        return (String) this.entity.getProperty(Lesson.TITLE_PROPERTY_KEY);%0A    %7D%0A%0A    public void setTitle(String title) %7B%0A        this.entity.setProperty(Lesson.TITLE_PROPERTY_KEY, title);%0A    %7D%0A%0A    public String getDescription() %7B%0A        return (String) this.entity.getProperty(Lesson.DESCRIPTION_PROPERTY_KEY);%0A    %7D%0A%0A    public void setDescription(String description) %7B%0A        this.entity.setProperty(Lesson.DESCRIPTION
 _PRO

Add Helper functions