#!/usr/bin/env python3
from __future__ import annotations

import requests

from _common import API_ROOT, api_request, build_auth_parser, dump, tenant_access_token


def main() -> int:
    parser = build_auth_parser("Delete Feishu calendar event")
    parser.add_argument("--calendar-id", required=True)
    parser.add_argument("--event-id", required=True)
    args = parser.parse_args()
    token = tenant_access_token(args.app_id, args.app_secret)
    result = api_request(
        "DELETE",
        f"{API_ROOT}/calendar/v4/calendars/{args.calendar_id}/events/{args.event_id}",
        token=token,
    )
    dump(result if result else {"status": "success"})
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
