mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.6 KiB
61 lines
1.6 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using Squidex.Infrastructure;
|
|
using System;
|
|
|
|
namespace Squidex.Domain.Apps.Core.Contents
|
|
{
|
|
public struct Status : IEquatable<Status>
|
|
{
|
|
public static readonly Status Archived = new Status("Archived");
|
|
public static readonly Status Draft = new Status("Draft");
|
|
public static readonly Status Published = new Status("Published");
|
|
|
|
private readonly string name;
|
|
|
|
public string Name
|
|
{
|
|
get { return name ?? "Unknown"; }
|
|
}
|
|
|
|
public Status(string name)
|
|
{
|
|
this.name = name;
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
return obj is Status status && Equals(status);
|
|
}
|
|
|
|
public bool Equals(Status other)
|
|
{
|
|
return string.Equals(name, other.name);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return name?.GetHashCode() ?? 0;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return name;
|
|
}
|
|
|
|
public static bool operator ==(Status lhs, Status rhs)
|
|
{
|
|
return lhs.Equals(rhs);
|
|
}
|
|
|
|
public static bool operator !=(Status lhs, Status rhs)
|
|
{
|
|
return !lhs.Equals(rhs);
|
|
}
|
|
}
|
|
}
|
|
|