using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using ReallifeGamemode.Database.Models;

namespace ReallifeGamemode.Database.Entities
{
  public partial class GroupVehicle : ServerVehicle
  {
    public Group Group { get; set; }

    [ForeignKey("Group")]
    public int? GroupId { get; set; }

    public override string ToString()
    {
      using (var dbContext = new DatabaseContext())
        return "Gruppen Fahrzeug | Gruppe: " + dbContext.Groups.First(g => g.Id == GroupId).Name;
    }
  }
}
