using CrazyStudio.Core.Common;
using CrazyStudio.Core.Common.AliyunExt.Oss.Tools;
using CrazyStudio.Core.Common.Eitities;
using CrazyStudio.Core.Common.Tools;
using Dto.SignalRNet;
using Duende.IdentityModel;
using MessagePack;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using System;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.IdentityModel.Tokens.Jwt;
using System.Text.Json;
using System.Threading.Tasks;
using XPrintServer.Api.Dto;
using XPrintServer.Api.Entities;
using XPrintServer.Api.Hubs;
using XPrintServer.Api.Net;
using XPrintServer.Api.Tools;
using XPrintServer.DataModel;
using XPrintServer.DataModel.Models;

namespace XPrintServer.Api.Controllers.Common
{

    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SyncImageController : ControllerBase
    {

        private readonly IHttpContextAccessor _httpContextAccessor;
        private readonly IHubContext<MsgHub> _hubContext;
        public SyncImageController(IHttpContextAccessor httpContextAccessor, IHubContext<MsgHub> hubContext)
        {
            _httpContextAccessor = httpContextAccessor;
            _hubContext = hubContext;
        }



        //[HttpPost()]
        //public async Task<IActionResult> Sync([FromBody] SyncImageInfo info)
        //{
        //    info.SubmitTime = DateTime.Now;
        //    // 向所有连接的客户端发送消息
        //    await _hubContext.Clients.Group(info.UserId).SendAsync(NetEventKeys.RECEIVE_MSG, new BaseMessage
        //    {
        //        MsgType = NetEventKeys.SYNC_IMAGE,
        //        Data = MessagePackSerializer.Serialize(info)
        //    });
        //    return Ok("图片已发送");
        //}
    }
}
