using BPA.SAAS.Manage.Application.Org.Dtos.Organize;
using BPA.SAAS.Manage.Application.Org.Interface;
using BPA.SAAS.Manage.Core.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.Org
{
    [ApiDescriptionSettings("Org", Tag = "组织机构管理")]
    public class OrganizeServices: IDynamicApiController
    {
        IOrganizeService _organizeService;
        public OrganizeServices(IOrganizeService organizeService) 
        {
            _organizeService=organizeService;
        }
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("/api/organize/page")]
        public async Task<PageUtil> QueryOrgPageList([FromBody]OrgPageInput input)
        {
            return await _organizeService.QueryOrgPageList(input);
        }
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("/api/organize/getorglist")]
        public async Task<List<OrgOutput>> GetOrgList(OrgListInput input)
        {
            return await _organizeService.GetOrgList(input);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("/api/organize/addorg")]
        public async Task<bool> AddOrg(OrgAddInput input)
        {
            return await _organizeService.AddOrg(input);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet("/api/organize/deleteorg")]
        public async Task<bool> DeleteOrg(string id)
        {
            return await _organizeService.DeleteOrg(id);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("/api/organize/updateorg")]
        public async Task<bool> UpdateOrg(UpdateOrgInput input)
        {
            return await _organizeService.UpdateOrg(input);
        }
        /// <summary>
        /// 获取组织机构树
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/organize/tree")]
        public async Task<dynamic> GetOrgTree()
        {
            return await _organizeService.GetOrgTree();
        }
        [HttpGet("/api/organize/getorglist")]
        public async Task<Dictionary<string, object>> GetOrgList()
        {
            return await _organizeService.GetOrgList();
        }
    }
}
