using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ECMJobRunner.Domain.Entities
{
///
/// SQL Job Configuration for Profile
/// Represents individual SQL jobs within a job runner profile
///
[Table("TBJR_CFG_PROFILE_SQLJOB", Schema = "dbo")]
public class ProfileSqlJob
{
///
/// Primary Key
///
[Key]
[Column("PK_TBJR_CFG_PROFILE_SQLJOB_ID")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
///
/// Foreign Key to Profile
///
[Required]
[Column("FK_TBJR_CFG_PROFILE_ID")]
[ForeignKey(nameof(CfgProfile))]
public long ProfileId { get; set; }
///
/// Active / Inactive switch
///
[Required]
[Column("ACTIVE")]
public bool Active { get; set; } = true;
///
/// Sequence order within the profile
///
[Required]
[Column("SEQUENCE")]
public short Sequence { get; set; } = 0;
///
/// Optional name (max 150 chars)
///
[Column("NAME")]
[MaxLength(150)]
public string? Name { get; set; }
///
/// SQL Check Query
///
[Column("SQL_CHECK_QUERY")]
public string? SqlCheckQuery { get; set; }
///
/// SQL Main Query
///
[Column("SQL_MAIN_QUERY")]
public string? SqlMainQuery { get; set; }
///
/// API Command
///
[Column("API_COMMAND")]
public string? ApiCommand { get; set; }
///
/// 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
///
/// Associated Profile
///
public virtual CfgProfile? CfgProfile { get; set; }
}
}