package cn.axzo.msg.center.message.service.impl.v3;

import cn.axzo.msg.center.service.enums.TerminalTypeEnum;
import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

/**
 * @author yanglin
 */
@Getter
@Setter
@SuppressWarnings("unused")
public class AppLink {

    private TerminalTypeEnum platform;
    private String url;

    public AppLink() {
    }

    public AppLink(TerminalTypeEnum terminalType, String url) {
        this(terminalType.name(), url);
    }

    public AppLink(String platform, String url) {
        this.platform = TerminalTypeEnum.valueOf(platform);
        this.url = url;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof AppLink)) return false;
        AppLink appLink = (AppLink) o;
        return Objects.equals(platform, appLink.platform) && Objects.equals(url, appLink.url);
    }

    @Override
    public int hashCode() {
        return Objects.hash(platform, url);
    }
}