package cn.iocoder.yudao.module.order.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Objects;

@Data
@ApiModel("费用分组dto")
public class FeeGroupDto {

    @ApiModelProperty("金额")
    private BigDecimal amount;
    @ApiModelProperty("货币id")
    private Long currencyId;
    @ApiModelProperty("货币名称(只展示英文代码)")
    private String currencyName;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FeeGroupDto that = (FeeGroupDto) o;
        return Objects.equals(currencyId, that.currencyId);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(currencyId);
    }

    public void addAmount(BigDecimal amount) {
        this.amount = this.amount.add(amount);
    }
}
