package com.yourname.premiumah.model;

import org.bukkit.inventory.ItemStack;

import java.util.Objects;
import java.util.UUID;

public final class ClaimRecord {
    private final String id;
    private final UUID ownerUuid;
    private final String ownerName;
    private final String listingId;
    private final ClaimType type;
    private final ClaimReason reason;
    private ItemStack item;
    private double moneyAmount;
    private final long createdAt;

    public ClaimRecord(String id,
                       UUID ownerUuid,
                       String ownerName,
                       String listingId,
                       ClaimType type,
                       ClaimReason reason,
                       ItemStack item,
                       double moneyAmount,
                       long createdAt) {
        this.id = Objects.requireNonNull(id, "id");
        this.ownerUuid = Objects.requireNonNull(ownerUuid, "ownerUuid");
        this.ownerName = Objects.requireNonNullElse(ownerName, "Unknown");
        this.listingId = listingId;
        this.type = Objects.requireNonNull(type, "type");
        this.reason = Objects.requireNonNull(reason, "reason");
        this.item = item == null ? null : item.clone();
        this.moneyAmount = moneyAmount;
        this.createdAt = createdAt;
    }

    public String id() {
        return id;
    }

    public UUID ownerUuid() {
        return ownerUuid;
    }

    public String ownerName() {
        return ownerName;
    }

    public String listingId() {
        return listingId;
    }

    public ClaimType type() {
        return type;
    }

    public ClaimReason reason() {
        return reason;
    }

    public ItemStack item() {
        return item == null ? null : item.clone();
    }

    public ItemStack rawItem() {
        return item;
    }

    public void item(ItemStack item) {
        this.item = item == null ? null : item.clone();
    }

    public double moneyAmount() {
        return moneyAmount;
    }

    public void moneyAmount(double moneyAmount) {
        this.moneyAmount = moneyAmount;
    }

    public long createdAt() {
        return createdAt;
    }
}
