package com.atlassian.bitbucket.mirroring.upstream;

import com.atlassian.bitbucket.audit.Priority;
import com.atlassian.bitbucket.event.ApplicationEvent;
import com.atlassian.bitbucket.event.annotation.Audited;
import com.atlassian.bitbucket.event.annotation.TransactionAware;
import com.atlassian.bitbucket.internal.mirroring.upstream.MirroringRequestEventConverter;
import com.atlassian.bitbucket.internal.mirroring.MirroringRequest;

import javax.annotation.Nonnull;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * @since 4.3
 */
@TransactionAware
@Audited(converter = MirroringRequestEventConverter.class, priority = Priority.HIGH)
public abstract class MirroringRequestEvent extends ApplicationEvent {
    private final MirroringRequest request;

    public MirroringRequestEvent(@Nonnull Object source, @Nonnull MirroringRequest request) {
        super(source);
        this.request = checkNotNull(request, "request");
    }

    @Nonnull
    public MirroringRequest getRequest() {
        return request;
    }
}
