package com.atlassian.bitbucket.internal.mirroring.mirror.rest.webhook.server;

import com.atlassian.bitbucket.internal.mirroring.mirror.rest.server.RestServerExternalRepository;
import com.atlassian.bitbucket.internal.mirroring.mirror.webhook.RepositoryModifiedWebHookEvent;
import com.atlassian.bitbucket.internal.mirroring.mirror.webhook.WebHookEventVisitor;

import javax.annotation.Nonnull;
import javax.validation.constraints.NotNull;
import java.util.Map;

import static com.atlassian.bitbucket.internal.mirroring.mirror.rest.webhook.server.RestServerWebHookPropertyNames.NEW;

public class RestServerRepositoryModifiedWebHookEvent extends BaseRestServerRepositoryWebHookEvent implements RepositoryModifiedWebHookEvent {
    public RestServerRepositoryModifiedWebHookEvent() {
    }

    public RestServerRepositoryModifiedWebHookEvent(Map<String, ?> values) {
        super(values);
    }

    @NotNull
    public RestServerExternalRepository getRepository() {
        return RestServerExternalRepository.valueOf(get(NEW));
    }

    @Override
    public <T> T visit(@Nonnull WebHookEventVisitor<T> visitor) {
        return visitor.accept(this);
    }
}
