using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using e_suite.Database.Audit.Attributes;
using e_suite.Database.Core.Models;
using Microsoft.EntityFrameworkCore;

namespace e_suite.Database.Core.Tables.UserManager;

[DisplayName("Sso Provider")]
[Table("SsoProviders", Schema = "UserManager")]
[Index(nameof(Name), IsUnique = true)]
[Index(nameof(Guid), IsUnique = true)]
public class SsoProvider : IGeneralId
{
    [Key]
    public long Id { get; set; }

    [AuditName]
    [Required]
    public string Name { get; set; } = string.Empty;

    [RedactAudit]
    [Required]
    public string ClientId { get; set; } = string.Empty;

    [RedactAudit]
    [Required]
    public string ClientSecret { get; set; } = string.Empty;

    [Required]
    public string ValidIssuer { get; set; } = string.Empty;

    [Required]
    public string AuthorizationEndpoint { get; set; } = string.Empty;

    [Required]
    public string TokenEndpoint { get; set; } = string.Empty;

    [Required]
    public bool IsPublic { get; set; } = true;

    [AuditSoftDelete(true)]
    [Required]
    public bool Deleted { get; set; } = false;

    public Guid Guid { get; set; } = Guid.NewGuid();

    [AuditLastUpdated]
    public DateTimeOffset LastUpdated { get; set; }

}