Imports BacklinksWarrior
Imports System.ComponentModel

Public Class LinkSite
    Implements IEqualityComparer(Of LinkSite)
    Implements INotifyPropertyChanged

    Private _status As LinkSiteStatus
    Private _keyword As String
    Private _pageUrl As String
    Private _notes As String
    Private _pageRank As Integer

    Public Property Status As LinkSiteStatus
        Get
            Return _status
        End Get
        Set(value As LinkSiteStatus)
            _status = value
            NotifyPropertyChanged("Status")
        End Set
    End Property

    Public Property Keyword As String
        Get
            Return _keyword
        End Get
        Set(value As String)
            _keyword = value
            NotifyPropertyChanged("Keyword")
        End Set
    End Property

    Public Property PageUrl As String
        Get
            Return _pageUrl
        End Get
        Set(value As String)
            _pageUrl = value
            NotifyPropertyChanged("PageUrl")
        End Set
    End Property

    Public Property Notes As String
        Get
            Return _notes
        End Get
        Set(value As String)
            _notes = value
            NotifyPropertyChanged("Notes")
        End Set
    End Property

    Public Property PageRank As Integer
        Get
            Return _pageRank
        End Get
        Set(value As Integer)
            _pageRank = value
            NotifyPropertyChanged("PageRank")
        End Set
    End Property

    Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged

    Public Overloads Function [Equals](x As LinkSite, y As LinkSite) As Boolean Implements IEqualityComparer(Of LinkSite).[Equals]
        If x.PageUrl = y.PageUrl Then
            Return True
        End If

        Return False
    End Function

    Public Function GetHashCode(obj As LinkSite) As Integer Implements IEqualityComparer(Of LinkSite).GetHashCode
        Return PageUrl.GetHashCode()
    End Function

    Private Sub NotifyPropertyChanged(propertyName As String)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
    End Sub
End Class

Public Enum LinkSiteStatus
    [New]
    Added
    Ignored
End Enum
