package com.auto.clicker.autoclicker.room.entity;

import static androidx.room.ForeignKey.CASCADE;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.PrimaryKey;

@Entity(tableName = "events",
        foreignKeys = {
                @ForeignKey(entity = Solution.class,
                        parentColumns = "solutionId",
                        childColumns = "solution_id",
                        onDelete = CASCADE),
                @ForeignKey(entity = TouchPoint.class,
                        parentColumns = "pointId",
                        childColumns = "click_point_id",
                        onDelete = CASCADE),
                @ForeignKey(entity = TouchPoint.class,
                        parentColumns = "pointId",
                        childColumns = "slide_start_point_id",
                        onDelete = CASCADE),
                @ForeignKey(entity = TouchPoint.class,
                        parentColumns = "pointId",
                        childColumns = "slide_end_point_id",
                        onDelete = CASCADE)
        })
public class EventEntity {
    @PrimaryKey(autoGenerate = true)
    public long eventId;

    @ColumnInfo(name = "solution_id")
    public long solutionId;

    @ColumnInfo(name = "event_type")
    public String eventType;

    @ColumnInfo(name = "order_in_solution")
    public int orderInSolution;

    @ColumnInfo(name = "click_point_id")
    public Long clickPointId;

    @ColumnInfo(name = "slide_start_point_id")
    public Long slideStartPointId;

    @ColumnInfo(name = "slide_end_point_id")
    public Long slideEndPointId;

    @ColumnInfo(name = "duration")
    public long duration;

    public EventEntity(long solutionId, String eventType, int orderInSolution,
                       Long clickPointId, Long slideStartPointId, Long slideEndPointId, long duration) {
        this.solutionId = solutionId;
        this.eventType = eventType;
        this.orderInSolution = orderInSolution;
        this.clickPointId = clickPointId;
        this.slideStartPointId = slideStartPointId;
        this.slideEndPointId = slideEndPointId;
        this.duration = duration;
    }

    public long getEventId() {
        return eventId;
    }

    public void setEventId(long eventId) {
        this.eventId = eventId;
    }

    public long getSolutionId() {
        return solutionId;
    }

    public void setSolutionId(long solutionId) {
        this.solutionId = solutionId;
    }

    public String getEventType() {
        return eventType;
    }

    public void setEventType(String eventType) {
        this.eventType = eventType;
    }

    public int getOrderInSolution() {
        return orderInSolution;
    }

    public void setOrderInSolution(int orderInSolution) {
        this.orderInSolution = orderInSolution;
    }

    public Long getClickPointId() {
        return clickPointId;
    }

    public void setClickPointId(Long clickPointId) {
        this.clickPointId = clickPointId;
    }

    public Long getSlideStartPointId() {
        return slideStartPointId;
    }

    public void setSlideStartPointId(Long slideStartPointId) {
        this.slideStartPointId = slideStartPointId;
    }

    public Long getSlideEndPointId() {
        return slideEndPointId;
    }

    public void setSlideEndPointId(Long slideEndPointId) {
        this.slideEndPointId = slideEndPointId;
    }

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }

}