using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using XYY.Core.Standard.Mvc;
using XYY.Service.Standard.Customer;

namespace XYY.Api.Customer.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CustomerController : ApiControllerBase
    {

        ICustomerService _customerService;
        public CustomerController(ICustomerService customerService)
        {
            _customerService = customerService;
        }


        public async Task<IActionResult> AlertFreezeCustomer(int? days)
        {
            if (days == null || days.Value <= 0)
                days = 3;

            await _customerService.AlertFreezeCustomer(days.Value);
            return Ok();
        }

        /// <summary>
        /// 多少天内不再通知
        /// </summary>
        /// <returns></returns>
        public async Task<string> NoAlertFreezedUntil(string customerIds, int days)
        {
            await _customerService.NoAlertFreezedUntil(customerIds, days);
            return "操作成功，请返回";
        }

        /// <summary>
        /// 延期冻结多少天
        /// </summary>
        /// <param name="days"></param>
        /// <returns></returns>
        public async Task<string> DelayFreezed(string customerIds, int days)
        {
            await _customerService.DelayFreezed(customerIds, days);
            return "操作成功，请返回";
        }
    }
}
