class HazelcastLock implements Serializable {

    private final String name;

    private final Instant lockAtMostUntil;

    private final Instant lockAtLeastUntil;

    /**
     * Moment when the lock is expired, so unlockable. The first value of this is
     * {@link #lockAtMostUntil}.
     */
    private final Instant timeToLive;

    private HazelcastLock(
            final String name,
            final Instant lockAtMostUntil,
            final Instant lockAtLeastUntil,
            final Instant timeToLive) {
        this.name = name;
        this.lockAtMostUntil = lockAtMostUntil;
        this.lockAtLeastUntil = lockAtLeastUntil;
        this.timeToLive = timeToLive;
    }

    boolean isExpired(Instant now) {
        return !now.isBefore(getTimeToLive());
    }

    /**
     * Instantiate {@link HazelcastLock} with {@link LockConfiguration} and
     * Hazelcast member UUID.
     *
     * @param configuration
     * @return the new instance of {@link HazelcastLock}.
     */
    static HazelcastLock fromConfigurationWhereTtlIsUntilTime(final LockConfiguration configuration) {
        return new HazelcastLock(
                configuration.getName(),
                configuration.getLockAtMostUntil(),
                configuration.getLockAtLeastUntil(),
                configuration.getLockAtMostUntil());
    }

    /**
     * Copy an existing {@link HazelcastLock} and change its time to live.
     *
     * @param lock
     * @return the new instance of {@link HazelcastLock}.
     */
    static HazelcastLock fromLockWhereTtlIsReduceToLeastTime(final HazelcastLock lock) {
        return new HazelcastLock(lock.name, lock.lockAtMostUntil, lock.lockAtLeastUntil, lock.lockAtLeastUntil);
    }

    String getName() {
        return name;
    }

    Instant getLockAtLeastUntil() {
        return lockAtLeastUntil;
    }

    Instant getTimeToLive() {
        return timeToLive;
    }

    @Override
    public String toString() {<FILL_FUNCTION_BODY>}
}

        return "HazelcastLock{" + "name='" + name + '\'' + ", lockAtMostUntil=" + lockAtMostUntil
                + ", lockAtLeastUntil=" + lockAtLeastUntil + ", timeToLive=" + timeToLive + '}';
    
<no_super_class>