using System.ComponentModel;
using LDBproject.Entities.Enums;

namespace LDBproject.Entities;

public class Book
{
    public int BookID { get; private set; }

    public string MainBookInfo => $"<<{Title}>>; {Author}";

    [DisplayName("< title >")]
    public string Title { get; private set; }
    [DisplayName("< author >")]
    public string Author { get; private set; }

    [DisplayName("< year of print >")]
    public int PublishYear { get; private set; }
    [DisplayName("< current position >")]
    public BookStat Status { get; private set; }
    [DisplayName("< genres >")]
    public Genres GenreMask { get; private set; } = Genres.None;

    public static Book AddBook(
        int bookIndex, string title, string author, int year, Genres genres, BookStat status)
    {
        return new Book
        {
            BookID = bookIndex,
            Title = title,
            Author = author,
            PublishYear = year,
            GenreMask = genres,
            Status = status
        };
    }
}