2024-03-02 00:43:56 +00:00
|
|
|
namespace OliverBooth.Common.Data.Web.Projects;
|
2023-09-24 14:36:36 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Represents a project.
|
|
|
|
/// </summary>
|
|
|
|
internal sealed class Project : IEquatable<Project>, IProject
|
|
|
|
{
|
|
|
|
/// <inheritdoc />
|
|
|
|
public string Description { get; private set; } = string.Empty;
|
|
|
|
|
2023-12-24 12:20:03 +00:00
|
|
|
/// <inheritdoc />
|
|
|
|
public string Details { get; private set; } = string.Empty;
|
|
|
|
|
2023-09-24 14:36:36 +01:00
|
|
|
/// <inheritdoc />
|
|
|
|
public string HeroUrl { get; private set; } = string.Empty;
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public Guid Id { get; private set; } = Guid.NewGuid();
|
|
|
|
|
2023-12-24 12:20:03 +00:00
|
|
|
/// <inheritdoc />
|
|
|
|
public IReadOnlyList<string> Languages { get; private set; } = ArraySegment<string>.Empty;
|
|
|
|
|
2023-09-24 14:36:36 +01:00
|
|
|
/// <inheritdoc />
|
|
|
|
public string Name { get; private set; } = string.Empty;
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public int Rank { get; private set; }
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public string? RemoteTarget { get; private set; }
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public string? RemoteUrl { get; private set; }
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public string Slug { get; private set; } = string.Empty;
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public ProjectStatus Status { get; private set; } = ProjectStatus.Ongoing;
|
|
|
|
|
2023-12-24 12:20:03 +00:00
|
|
|
/// <inheritdoc />
|
|
|
|
public string? Tagline { get; private set; }
|
|
|
|
|
2023-09-24 14:36:36 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Returns a value indicating whether two instances of <see cref="Project" /> are equal.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="left">The first instance of <see cref="Project" /> to compare.</param>
|
|
|
|
/// <param name="right">The second instance of <see cref="Project" /> to compare.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are equal; otherwise,
|
|
|
|
/// <see langword="false" />.
|
|
|
|
/// </returns>
|
|
|
|
public static bool operator ==(Project? left, Project? right) => Equals(left, right);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Returns a value indicating whether two instances of <see cref="Project" /> are not equal.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="left">The first instance of <see cref="Project" /> to compare.</param>
|
|
|
|
/// <param name="right">The second instance of <see cref="Project" /> to compare.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are not equal; otherwise,
|
|
|
|
/// <see langword="false" />.
|
|
|
|
/// </returns>
|
|
|
|
public static bool operator !=(Project? left, Project? right) => !(left == right);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Returns a value indicating whether this instance of <see cref="Project" /> is equal to another
|
|
|
|
/// instance.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="other">An instance to compare with this instance.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// <see langword="true" /> if <paramref name="other" /> is equal to this instance; otherwise,
|
|
|
|
/// <see langword="false" />.
|
|
|
|
/// </returns>
|
|
|
|
public bool Equals(Project? other)
|
|
|
|
{
|
2024-02-25 14:11:33 +00:00
|
|
|
if (ReferenceEquals(null, other))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ReferenceEquals(this, other))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-09-24 14:36:36 +01:00
|
|
|
return Id.Equals(other.Id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Returns a value indicating whether this instance is equal to a specified object.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="obj">An object to compare with this instance.</param>
|
|
|
|
/// <returns>
|
|
|
|
/// <see langword="true" /> if <paramref name="obj" /> is an instance of <see cref="Project" /> and equals the
|
|
|
|
/// value of this instance; otherwise, <see langword="false" />.
|
|
|
|
/// </returns>
|
|
|
|
public override bool Equals(object? obj)
|
|
|
|
{
|
|
|
|
return ReferenceEquals(this, obj) || obj is Project other && Equals(other);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the hash code for this instance.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The hash code.</returns>
|
|
|
|
public override int GetHashCode()
|
|
|
|
{
|
|
|
|
// ReSharper disable once NonReadonlyMemberInGetHashCode
|
|
|
|
return Id.GetHashCode();
|
|
|
|
}
|
|
|
|
}
|