package com.dji.sample.manage.service;

import com.dji.sample.manage.model.dto.OperateRecordDTO;
import com.dji.sample.manage.model.enums.OperateRecordTypeEnum;
import com.dji.sdk.common.PaginationData;

import javax.servlet.http.HttpServletRequest;

/**
 * Service for recording user-triggered operations into the {@code operate_record} table.
 */
public interface IOperateRecordService {

    /**
     * Record an operation.
     *
     * @param request    HTTP request (used to extract IP and token claims)
     * @param type       operation type
     * @param dockSn     dock serial number involved (may be null)
     * @param param      JSON-serializable request parameter object (may be null)
     * @param content    human-readable description override; if null, uses enum description
     */
    void record(HttpServletRequest request,
                OperateRecordTypeEnum type,
                String dockSn,
                Object param,
                String content);

    /**
     * Convenience overload — uses the enum's built-in description.
     */
    void record(HttpServletRequest request,
                OperateRecordTypeEnum type,
                String dockSn,
                Object param);

    /**
     * Paginated query of operation records.
     *
     * @param workspaceId   filter by workspace (required)
     * @param userId        filter by user ID (null = all users, for admins only)
     * @param dockSn        filter by dock SN (optional)
     * @param operatingType filter by operation type (optional)
     * @param startTime     filter by start time in ms (optional)
     * @param endTime       filter by end time in ms (optional)
     * @param page          page number (1-based)
     * @param pageSize      page size
     */
    PaginationData<OperateRecordDTO> page(String workspaceId,
                                          String userId,
                                          String dockSn,
                                          String operatingType,
                                          Long startTime,
                                          Long endTime,
                                          int page,
                                          int pageSize);


}
