
package dev.sonpx.loyalty.mcp.model;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * Created by SonPhung on Monday, 20-Jul-2026
 */
@Getter
@Setter
@NoArgsConstructor
public class ReferenceData implements Serializable {

    protected String code;
    protected String description;
    protected boolean notFound;
    protected String recordStatus;
    protected Map<String, Object> attributes = new HashMap<>();

    public ReferenceData(String code) {
        this.code = code;
    }

    public ReferenceData(String code, String description) {
        this.code = code;
        this.description = description;
        this.notFound = false;
    }

    public ReferenceData(String code, String description, Boolean notFound) {
        this.code = code;
        this.description = description;
        this.notFound = notFound;
    }

    public ReferenceData(String code, String description, boolean notFound, String recordStatus) {
        this.code = code;
        this.description = description;
        this.notFound = notFound;
        this.recordStatus = recordStatus;
    }

    public ReferenceData(String code, String description, Map<String, Object> attributes) {
        this.code = code;
        this.description = description;
        this.attributes = attributes;
    }

    public void addAttribute(String key, Object value) {
        this.attributes.put(key, value);
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        ReferenceData that = (ReferenceData) o;
        return Objects.equals(code, that.code) && Objects.equals(description, that.description);
    }

    @Override
    public int hashCode() {
        return Objects.hash(code, description);
    }

    @Override
    public String toString() {
        return "ReferenceData{" + "code='" + code + '\'' + ", notFound=" + notFound + '}';
    }
}
