using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("oauth_app")]
[Index(nameof(ClientId), IsUnique = true)]
public class OauthApp
{
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
///
/// The created date of the OAuth application
///
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
///
/// The client id of the OAuth application
///
[Column("clientId")]
[StringLength(64)]
public string ClientId { get; set; } = null!;
///
/// The client secret of the OAuth application
///
[Column("clientSecret")]
[StringLength(64)]
public string ClientSecret { get; set; } = null!;
///
/// The name of the OAuth application
///
[Column("name")]
[StringLength(128)]
public string Name { get; set; } = null!;
///
/// The website of the OAuth application
///
[Column("website")]
[StringLength(256)]
public string? Website { get; set; }
///
/// The scopes requested by the OAuth application
///
[Column("scopes", TypeName = "character varying(64)[]")]
public List Scopes { get; set; } = null!;
///
/// The redirect URIs of the OAuth application
///
[Column("redirectUris", TypeName = "character varying(512)[]")]
public List RedirectUris { get; set; } = null!;
[InverseProperty(nameof(OauthToken.App))]
public virtual ICollection OauthTokens { get; set; } = new List();
///
/// The app token, returned by /oauth/token when grant_type client_credentials is requested
///
[Column("appToken")] [StringLength(64)]
public string? Token;
}