using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("gallery_post")]
[Index(nameof(Tags))]
[Index(nameof(LikedCount))]
[Index(nameof(FileIds))]
[Index(nameof(CreatedAt))]
[Index(nameof(UserId))]
[Index(nameof(IsSensitive))]
[Index(nameof(UpdatedAt))]
public class GalleryPost
{
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
///
/// The created date of the GalleryPost.
///
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
///
/// The updated date of the GalleryPost.
///
[Column("updatedAt")]
public DateTime UpdatedAt { get; set; }
[Column("title")] [StringLength(256)] public string Title { get; set; } = null!;
[Column("description")]
[StringLength(2048)]
public string? Description { get; set; }
///
/// The ID of author.
///
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
[Column("fileIds", TypeName = "character varying(32)[]")]
public List FileIds { get; set; } = null!;
///
/// Whether the post is sensitive.
///
[Column("isSensitive")]
public bool IsSensitive { get; set; }
[Column("likedCount")] public int LikedCount { get; set; }
[Column("tags", TypeName = "character varying(128)[]")]
public List Tags { get; set; } = null!;
[InverseProperty(nameof(GalleryLike.Post))]
public virtual ICollection GalleryLikes { get; set; } = new List();
[ForeignKey(nameof(UserId))]
[InverseProperty(nameof(Tables.User.GalleryPosts))]
public virtual User User { get; set; } = null!;
}