package schema

import (
	"time"

	"entgo.io/ent"
	"entgo.io/ent/schema/field"
	"entgo.io/ent/schema/index"
)

type CommentLikes struct {
	ent.Schema
}

func (CommentLikes) Fields() []ent.Field {
	return []ent.Field{
		field.Int64("id").Immutable().Unique(),
		field.Int64("comment_id"),
		field.Int64("user_id"),
		field.Time("created_at").Default(time.Now).Immutable(),
	}
}

func (CommentLikes) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("comment_id", "user_id").Unique(),
		index.Fields("user_id", "comment_id"),
		index.Fields("user_id", "created_at"),
	}
}
