using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("webhook")]
[Index("Active")]
[Index("On")]
[Index("UserId")]
public class Webhook
{
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
///
/// The created date of the Antenna.
///
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
///
/// The owner ID.
///
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
///
/// The name of the Antenna.
///
[Column("name")]
[StringLength(128)]
public string Name { get; set; } = null!;
[Column("on", TypeName = "character varying(128)[]")]
public List On { get; set; } = null!;
[Column("url")] [StringLength(1024)] public string Url { get; set; } = null!;
[Column("secret")]
[StringLength(1024)]
public string Secret { get; set; } = null!;
[Column("active")] public bool Active { get; set; }
[Column("latestSentAt")] public DateTime? LatestSentAt { get; set; }
[Column("latestStatus")] public int? LatestStatus { get; set; }
[ForeignKey("UserId")]
[InverseProperty(nameof(Tables.User.Webhooks))]
public virtual User User { get; set; } = null!;
}