using QYZH.InteractiveMagazine.Common.Extensions;
using QYZH.InteractiveMagazine.Common.Helpers;
using QYZH.InteractiveMagazine.Models.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QYZH.InteractiveMagazine.Models.Dto.Journal
{
    public class JournalDto
    {
        /// <summary>
        /// Desc:主键id
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// Desc:书籍名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// Desc:标题
        /// </summary>
        public string? Title { get; set; }

        /// <summary>
        /// Desc:总页数
        /// </summary>
        public int TotalPage { get; set; }

        /// <summary>
        /// Desc:校验页数
        /// </summary>
        public int VerifyPage { get; set; }


        /// <summary>
        /// Desc:状态
        /// </summary>
        public JournalStatusEnum Status { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public string ShowStatus => Status.GetDescription();

        private string _pdfUrl;
        /// <summary>
        /// pdf预览地址
        /// </summary>
        public string PdfUrl
        {
            get => DomainHelper.OssFullUrl(_pdfUrl);
            set => _pdfUrl = value;
        }

        /// <summary>
        /// Desc:宽度
        /// </summary>
        public float Width { get; set; }

        /// <summary>
        /// Desc:高度
        /// </summary>
        public float Height { get; set; }

        /// <summary>
        /// Desc:乐观锁
        /// </summary>
        public int Revision { get; set; }

        /// <summary>
        /// Desc:审查结果(默认0 1通过 -1驳回)
        /// </summary>
        public int Result { get; set; }

        private string _cover;
        /// <summary>
        /// 封面
        /// </summary>
        public string Cover
        {
            get => DomainHelper.OssFullUrl(_cover);
            set => _cover = value;
        }

        private string _backCover;
        /// <summary>
        /// 封底
        /// </summary>
        public string BackCover
        {
            get => DomainHelper.OssFullUrl(_backCover);
            set => _backCover = value;
        }


        private string _pdfPreviewUrl;

        /// <summary>
        /// pdf预览地址
        /// </summary>
        public string PdfPreviewUrl
        {
            get => DomainHelper.OssFullUrl(_pdfPreviewUrl);
            set => _pdfPreviewUrl = value;
        }


        /// <summary>
        /// Desc:
        /// </summary>
        public string? Description { get; set; }

        /// <summary>
        /// Desc:下载书籍页码点阵码PDF文件名称
        /// </summary>
        public string? DownloadJournalPagePdfName { get; set; }

        /// <summary>
        /// 发布开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 发布结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }


        public string CreatedBy {  get; set; }
        public DateTime CreatedAt {  get; set; }
    }

    public class JournalPublishBookMessage
    {
        public long BookId { get; set; }
        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }
    }

    public class JournalPublishBookPageMessage
    {
        public long BookId { get; set; }
        public long PageId { get; set; }
        public string Url {  get; set; }
        public string? PageNo { get; set; }
        public string? Layout { get; set; }
        public string QuestionNo {  get; set; }
    }
}
