using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Blahblah.FlowerStory.Server.Data.Model;

[Table("records")]
public class RecordItem
{
    [Column("rid"), Key, Required]
    public int Id { get; set; }

    [Column("eid"), Required]
    public int EventId { get; set; }

    [Column("date"), Required]
    public long DateUnixTime { get; set; }

    [Column("byuid")]
    public int? ByUserId { get; set; }

    [Column("byname")]
    public string? ByUserName { get; set; }

    [Column("photo")]
    public byte[]? Photo { get; set; }

    [NotMapped]
    public DateTimeOffset Date => DateTimeOffset.FromUnixTimeMilliseconds(DateUnixTime);
}