package com.ningdatech.pmapi.common.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;

import java.util.Objects;

/**
 * <p>
 * RegionMapKey
 * </p>
 *
 * @author WendyYang
 * @since 13:54 2023/3/1
 */
@Data
@AllArgsConstructor
public class RegionMapKey {

    public static RegionMapKey of(String regionCode, int regionLevel) {
        return new RegionMapKey(regionCode, regionLevel);
    }

    /**
     * 区域码
     */
    private String regionCode;

    /**
     * 地区级别
     */
    private Integer regionLevel;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        RegionMapKey regionMapKey = (RegionMapKey) o;
        return regionCode.equals(regionMapKey.getRegionCode())
                && regionLevel.equals(regionMapKey.getRegionLevel());
    }

    @Override
    public int hashCode() {
        return Objects.hash(regionCode, regionLevel);
    }
}
