# PostgreSQL Entities

Create the following classes for the entities that will exist in the API based on the diagram above.

{% code title=".\Entities\User.cs" %}

```csharp
using System;

namespace SlackClone.Entities
{
    public class User
    {
        public Guid Id { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string FullName { get => $"{FirstName} {LastName}"; }
        public string Email { get; set; }
        public string Username { get; set; }
        public string Password { get; set; }
        public UserStatus Status { get; set; }
    }
}
```

{% endcode %}

{% code title=".\Entities\UserStatus.cs" %}

```csharp
using System;

namespace SlackClone.Entities
{
    public class UserStatus
    {
        public Guid Id { get; set; }
        public string Status { get; set; }
        public string Description { get; set; }
        public int Rank { get; set; }
    }
}
```

{% endcode %}

{% code title=".\Entities\DirectMessage.cs" %}

```csharp
using System;

namespace SlackClone.Entities
{
    public class DirectMessage
    {
        public Guid Id { get; set; }
        public string Content { get; set; }
        public User CreatedBy { get; set; }
        public User SentTo { get; set; }
        public DateTime CreatedAt { get; set; }
    }
}

```

{% endcode %}

{% code title=".\Entities\Channel.cs" %}

```csharp
using System;
using System.Collections.Generic;

namespace SlackClone.Entities
{
    public class Channel
    {
        public Guid Id { get; set; }
        public string Name { get; set; }
        public ICollection<ChannelChannelMessage> 
            ChannelsChannelMessages { get; set; }
    }
}
```

{% endcode %}

{% code title=".\Entities\ChannelMessage.cs" %}

```csharp
using System;
using System.Collections.Generic;

namespace SlackClone.Entities
{
    public class ChannelMessage
    {
        public Guid Id { get; set; }
        public string Content { get; set; }
        public User CreatedBy { get; set; }
        public DateTime CreatedAt { get; set; }
        public int Likes { get; set; }
        public ICollection<ChannelChannelMessage> 
            ChannelsChannelMessages { get; set; }
    }
}
```

{% endcode %}

{% code title=".\Entities\ChannelChannelMessage.cs" %}

```csharp
using System;

namespace SlackClone.Entities
{
    public class ChannelChannelMessage
    {
        public Guid ChannelId { get; set; }
        public Channel Channel { get; set; }
        public Guid MessageId { get; set; }
        public ChannelMessage ChannelMessage { get; set; }
    }
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://arif-hanif.gitbook.io/slackclone/server/api/data-modeling/entities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
