// Path: src/main/java/killrvideo/utils/TypeConverter.java
// public class TypeConverter {
// 
//     public static Timestamp instantToTimeStamp(Instant instant) {
//         return Timestamp.newBuilder()
//                 .setSeconds(instant.getEpochSecond())
//                 .setNanos(instant.getNano()).build();
//     }
//     
//     public static Timestamp epochTimeToTimeStamp(long epoch) {
//         return Timestamp.newBuilder().setSeconds(epoch).build();
//     }
// 
//     public static Timestamp dateToTimestamp(Date date) {
//         return instantToTimeStamp(date.toInstant());
//     }
// 
//     public static Date dateFromTimestamp(Timestamp timestamp) {
//         return Date.from(Instant.ofEpochSecond(timestamp.getSeconds()));
//     }
// 
//     public static TimeUuid uuidToTimeUuid(UUID uuid) {
//         return TimeUuid.newBuilder()
//                 .setValue(uuid.toString())
//                 .build();
//     }
// 
//     public static Uuid uuidToUuid(UUID uuid) {
//         return Uuid.newBuilder()
//                 .setValue(uuid.toString())
//                 .build();
//     }
// 
//     /**
//      * This method is useful when debugging as an easy way to get a traversal
//      * string to use in gremlin or DSE Studio from bytecode.
//      * @param traversal
//      * @return
//      */
//     public static String bytecodeToTraversalString(KillrVideoTraversal<Vertex, Vertex> traversal) {
//         return org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslator.of("g").translate(traversal.getBytecode());
//     }
// }


import java.util.Date;
import java.util.Optional;
import java.util.UUID;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
import killrvideo.utils.TypeConverter;
import killrvideo.video_catalog.VideoCatalogServiceOuterClass.VideoPreview;
package killrvideo.entity;




/**
 * Pojo representing DTO for table 'user_videos'
 *
 * @author DataStax evangelist team.
 */
@Table(keyspace = Schema.KEYSPACE, name = Schema.TABLENAME_USER_VIDEOS)
public class UserVideos extends AbstractVideoList {

    /** Serial. */
    private static final long serialVersionUID = -4689177834790056936L;
    
    @PartitionKey
    private UUID userid;

    /**
     * Deafult Constructor allowing reflection.
     */
    public UserVideos() {}

    /**
     * Constructor without preview.
     */
    public UserVideos(UUID userid, UUID videoid, String name, Date addedDate) {
        this(userid, videoid, name, null, addedDate);
    }

    /**
     * Full set constructor.
     */
    public UserVideos(UUID userid, UUID videoid, String name, String previewImageLocation, Date addedDate) {
        super(name, previewImageLocation, addedDate, videoid);
        this.userid = userid;
    }

    /**
     * Mapping to generated GPRC beans.
     */
    public VideoPreview toVideoPreview() {
        return VideoPreview
                .newBuilder()
// Path: src/main/java/killrvideo/utils/TypeConverter.java
// public class TypeConverter {
// 
//     public static Timestamp instantToTimeStamp(Instant instant) {
//         return Timestamp.newBuilder()
//                 .setSeconds(instant.getEpochSecond())
//                 .setNanos(instant.getNano()).build();
//     }
//     
//     public static Timestamp epochTimeToTimeStamp(long epoch) {
//         return Timestamp.newBuilder().setSeconds(epoch).build();
//     }
// 
//     public static Timestamp dateToTimestamp(Date date) {
//         return instantToTimeStamp(date.toInstant());
//     }
// 
//     public static Date dateFromTimestamp(Timestamp timestamp) {
//         return Date.from(Instant.ofEpochSecond(timestamp.getSeconds()));
//     }
// 
//     public static TimeUuid uuidToTimeUuid(UUID uuid) {
//         return TimeUuid.newBuilder()
//                 .setValue(uuid.toString())
//                 .build();
//     }
// 
//     public static Uuid uuidToUuid(UUID uuid) {
//         return Uuid.newBuilder()
//                 .setValue(uuid.toString())
//                 .build();
//     }
// 
//     /**
//      * This method is useful when debugging as an easy way to get a traversal
//      * string to use in gremlin or DSE Studio from bytecode.
//      * @param traversal
//      * @return
//      */
//     public static String bytecodeToTraversalString(KillrVideoTraversal<Vertex, Vertex> traversal) {
//         return org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslator.of("g").translate(traversal.getBytecode());
//     }
// }


// Path: src/main/java/killrvideo/entity/UserVideos.java
import java.util.Date;
import java.util.Optional;
import java.util.UUID;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
import killrvideo.utils.TypeConverter;
import killrvideo.video_catalog.VideoCatalogServiceOuterClass.VideoPreview;

package killrvideo.entity;




/**
 * Pojo representing DTO for table 'user_videos'
 *
 * @author DataStax evangelist team.
 */
@Table(keyspace = Schema.KEYSPACE, name = Schema.TABLENAME_USER_VIDEOS)
public class UserVideos extends AbstractVideoList {

    /** Serial. */
    private static final long serialVersionUID = -4689177834790056936L;
    
    @PartitionKey
    private UUID userid;

    /**
     * Deafult Constructor allowing reflection.
     */
    public UserVideos() {}

    /**
     * Constructor without preview.
     */
    public UserVideos(UUID userid, UUID videoid, String name, Date addedDate) {
        this(userid, videoid, name, null, addedDate);
    }

    /**
     * Full set constructor.
     */
    public UserVideos(UUID userid, UUID videoid, String name, String previewImageLocation, Date addedDate) {
        super(name, previewImageLocation, addedDate, videoid);
        this.userid = userid;
    }

    /**
     * Mapping to generated GPRC beans.
     */
    public VideoPreview toVideoPreview() {
        return VideoPreview
                .newBuilder()
                .setAddedDate(TypeConverter.dateToTimestamp(getAddedDate()))