// 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.io.Serializable;
import java.util.UUID;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
import killrvideo.ratings.RatingsServiceOuterClass.GetUserRatingResponse;
import killrvideo.utils.TypeConverter;
package killrvideo.entity;




/**
 * Pojo representing DTO for table 'video_ratings_by_user'.
 *
 * @author DataStax evangelist team.
 */
@Table(keyspace = Schema.KEYSPACE, name = Schema.TABLENAME_VIDEOS_RATINGS_BYUSER)
public class VideoRatingByUser implements Serializable {

    /** Serial. */
    private static final long serialVersionUID = 7124040203261999049L;

    @PartitionKey
    private UUID videoid;

    @ClusteringColumn
    private UUID userid;

    @Column
    private int rating;

    /**
     * Default constructor (reflection)
     */
    public VideoRatingByUser() {}

    /**
     * Constructor with all parameters.
     */
    public VideoRatingByUser(UUID videoid, UUID userid, int rating) {
        this.videoid = videoid;
        this.userid = userid;
        this.rating = rating;
    }

    /**
     * Mapping to generated GPRC beans.
     */
    public GetUserRatingResponse toUserRatingResponse() {
        return GetUserRatingResponse
                .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/VideoRatingByUser.java
import java.io.Serializable;
import java.util.UUID;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
import killrvideo.ratings.RatingsServiceOuterClass.GetUserRatingResponse;
import killrvideo.utils.TypeConverter;

package killrvideo.entity;




/**
 * Pojo representing DTO for table 'video_ratings_by_user'.
 *
 * @author DataStax evangelist team.
 */
@Table(keyspace = Schema.KEYSPACE, name = Schema.TABLENAME_VIDEOS_RATINGS_BYUSER)
public class VideoRatingByUser implements Serializable {

    /** Serial. */
    private static final long serialVersionUID = 7124040203261999049L;

    @PartitionKey
    private UUID videoid;

    @ClusteringColumn
    private UUID userid;

    @Column
    private int rating;

    /**
     * Default constructor (reflection)
     */
    public VideoRatingByUser() {}

    /**
     * Constructor with all parameters.
     */
    public VideoRatingByUser(UUID videoid, UUID userid, int rating) {
        this.videoid = videoid;
        this.userid = userid;
        this.rating = rating;
    }

    /**
     * Mapping to generated GPRC beans.
     */
    public GetUserRatingResponse toUserRatingResponse() {
        return GetUserRatingResponse
                .newBuilder()
                .setUserId(TypeConverter.uuidToUuid(userid))