package com.ruoyi.system.service;

import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;

/**
 * 一次请求内解析出的商家门店访问上下文。
 */
public final class MerchantAccessContext {

    private final Long loginUserId;
    private final Long ownerUserId;
    private final boolean owner;
    private final Set<Long> storeIds;

    public MerchantAccessContext(Long loginUserId, Long ownerUserId,
                                 boolean owner, Set<Long> storeIds) {
        this.loginUserId = loginUserId;
        this.ownerUserId = ownerUserId;
        this.owner = owner;
        this.storeIds = Collections.unmodifiableSet(new LinkedHashSet<>(storeIds));
    }

    public Long loginUserId() {
        return loginUserId;
    }

    public Long ownerUserId() {
        return ownerUserId;
    }

    public boolean owner() {
        return owner;
    }

    public Set<Long> storeIds() {
        return storeIds;
    }
}
