using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ECMJobRunner.Domain.Entities
{
///
/// Job Runner Configuration Profile Entity
/// Represents a job runner profile configuration
/// Type: 0 = ADSync; 1 = GraphQL; 2 = SQL-Job; 3 = SQL and REST-Job
///
[Table("TBJR_CFG_PROFILE", Schema = "dbo")]
public class CfgProfile
{
///
/// Primary Key
///
[Key]
[Column("PK_TBJR_CFG_PROFILE_ID")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
///
/// Active / Inactive switch
///
[Required]
[Column("ACTIVE")]
public bool Active { get; set; } = true;
///
/// Profile name (max 150 chars)
///
[Required]
[Column("PROFILE_NAME")]
[MaxLength(150)]
public string ProfileName { get; set; } = null!;
///
/// Profile type: 0 = ADSync; 1 = GraphQL; 2 = SQL-Job; 3 = SQL and REST-Job
///
[Required]
[Column("TYPE_ID")]
public byte TypeId { get; set; }
///
/// Schedule in Cron format (max 150 chars)
///
[Required]
[Column("SCHEDULE")]
[MaxLength(150)]
public string Schedule { get; set; } = "0 30 4 ? * MON-SAT";
///
/// Optional description (max 500 chars)
///
[Column("COMMENT")]
[MaxLength(500)]
public string? Comment { get; set; }
///
/// Created by (max 50 chars)
///
[Required]
[Column("ADDED_WHO")]
[MaxLength(50)]
public string AddedWho { get; set; } = "DEFAULT";
///
/// Created at
///
[Required]
[Column("ADDED_WHEN")]
public DateTime AddedWhen { get; set; } = DateTime.Now;
///
/// Modified by (max 50 chars)
///
[Column("CHANGED_WHO")]
[MaxLength(50)]
public string? ChangedWho { get; set; }
///
/// Modified at
///
[Column("CHANGED_WHEN")]
public DateTime? ChangedWhen { get; set; }
// Navigation properties
///
/// SQL Jobs associated with this profile
///
public virtual IEnumerable? SqlJobs { get; set; }
///
/// Profile execution history
///
public virtual IEnumerable? ProfileHistories { get; set; }
}
}