type PrisonCommandGuardOptions = {
    prison?: boolean;
    jail?: boolean;
    adminJail?: boolean;
    all?: boolean;
};

export const PrisonCommandGuard = (options: PrisonCommandGuardOptions): CommandGuard => {
    return (player: PlayerMp) => {
        if ((options.prison || options.all) && player.character?.prison_cell_id) {
            return `You can't use this while imprisoned.`;
        }

        if ((options.jail || options.all) && player.state.jailed) {
            return `You can't use this while jailed.`;
        }

        if ((options.adminJail || options.all) && player.state.adminJail?.releaseTime) {
            return `You can't use this while admin jailed.`;
        }

        return true;
    };
};
