package com.codechecker.api.model;

import java.util.ArrayList;
import java.util.List;

/**
 * 单条 API 变更报告（路径 / 方法 / 参数各自独立，不与其他类型混合）。
 */
public class EndpointChangeReport {
    private final ApiChangeKind changeKind;
    private final String httpMethod;
    private final String oldHttpMethod;
    private final String uri;
    private final String oldUri;
    private final String sourceFile;
    private final String controllerClass;
    private final String endpointDescription;
    private final List<ParameterChange> parameterChanges = new ArrayList<>();

    public EndpointChangeReport(ApiChangeKind changeKind, String httpMethod, String oldHttpMethod,
                                String uri, String oldUri, String sourceFile, String controllerClass,
                                String endpointDescription) {
        this.changeKind = changeKind;
        this.httpMethod = httpMethod;
        this.oldHttpMethod = oldHttpMethod;
        this.uri = uri;
        this.oldUri = oldUri;
        this.sourceFile = sourceFile;
        this.controllerClass = controllerClass;
        this.endpointDescription = endpointDescription == null ? "" : endpointDescription;
    }

    public ApiChangeKind getChangeKind() {
        return changeKind;
    }

    public String getHttpMethod() {
        return httpMethod;
    }

    public String getOldHttpMethod() {
        return oldHttpMethod;
    }

    public String getUri() {
        return uri;
    }

    public String getOldUri() {
        return oldUri;
    }

    public String getSourceFile() {
        return sourceFile;
    }

    public String getControllerClass() {
        return controllerClass;
    }

    public String getEndpointDescription() {
        return endpointDescription;
    }

    public List<ParameterChange> getParameterChanges() {
        return parameterChanges;
    }

    public void addParameterChange(ParameterChange change) {
        parameterChanges.add(change);
    }

    public boolean hasParameterChanges() {
        return !parameterChanges.isEmpty();
    }
}
