package com.yuchen.saas.park.api.commons.domain;

import lombok.Data;

import javax.validation.constraints.Positive;
import java.util.Map;
import java.util.Set;

@Data(staticConstructor = "of")
public class BatchDoorAccessControl {
    private final Set<@Positive Long> doorAccessControlGroupIds;
    /**
     * 门禁组-门禁
     */
    private final Map<@Positive Long, Set<@Positive Long>> doorAccessControlGroupIdsMap;

    private final Set<@Positive Long> doorAccessControlIds;

    public Set<@Positive Long> listByGroupId(@Positive long doorAccessControlGroupId) {
        return doorAccessControlGroupIdsMap.getOrDefault(doorAccessControlGroupId, Set.of());
    }

    public boolean isEmpty() {
        return doorAccessControlGroupIds.isEmpty() && doorAccessControlIds.isEmpty();
    }
}
