"""
通知公告 API 客户端
"""

from httpx import AsyncClient


class NoticeAPI:
    """通知公告 API 客户端"""
    
    def __init__(self, client: AsyncClient):
        self.client = client
    
    async def get_notice_list(self):
        """获取公告列表"""
        return await self.client.get('/api/notices')
    
    async def get_notice_by_id(self, notice_id):
        """根据ID获取公告"""
        return await self.client.get(f'/api/notices/{notice_id}')
    
    async def create(self, notice_data):
        """创建公告"""
        return await self.client.post('/api/notices', json=notice_data)
    
    async def update(self, notice_id, notice_data):
        """更新公告"""
        return await self.client.put(f'/api/notices/{notice_id}', json=notice_data)
    
    async def delete(self, notice_id):
        """删除公告"""
        return await self.client.delete(f'/api/notices/{notice_id}')
    
    async def get_list(self, page: int = 0, size: int = 10):
        """分页获取公告列表"""
        return await self.client.get(f'/api/notices?page={page}&size={size}')
    
    async def get_all(self):
        """获取所有公告"""
        return await self.client.get('/api/notices/all')


class SysNoticeAPI(NoticeAPI):
    """系统公告 API (别名)"""
    pass


class SysMessageAPI(NoticeAPI):
    """系统消息 API (别名)"""
    pass
