using CloudGaming.DtoModel.Epg;

using HuanMeng.DotNetCore.AttributeExtend;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using static CloudGaming.DtoModel.Epg.EpgEnum;

namespace CloudGaming.DtoModel.Game;

/// <summary>
/// 游戏列表数据  
/// </summary>
public class GameListDto
{
    public GameListDto() { }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="gameInfo"></param>
    public GameListDto(GameInfo gameInfo, ImageResStyle imageResStyle)
    {
        if (gameInfo != null)
        {
            this.GameName = gameInfo.GameName;
            this.GameId = gameInfo.GameId;
            this.GameIconImage = imageResStyle.GetImageResStyle(gameInfo);
        }
    }
    /// <summary>
    /// 游戏Id
    /// </summary>
    public string GameId { get; set; }
    /// <summary>
    /// 游戏名称
    /// </summary>
    public string GameName { get; set; }

    /// <summary>
    /// 游戏icon
    /// </summary>
    [Images]
    public int GameIconImage { get; set; }

    public override bool Equals(object obj)
    {
        if (obj is GameListDto other)
        {
            return string.Equals(this.GameId, other.GameId, StringComparison.Ordinal);
        }
        return false;
    }

    public override int GetHashCode()
    {
        return this.GameId != null ? this.GameId.GetHashCode() : 0;
    }
}
