using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace foundation_system.Models;

[Table("colaboradores", Schema = "public")]
public class Colaborador
{
    [Key]
    [Column("id")]
    public long Id { get; set; }

    [Column("persona_id")]
    public long PersonaId { get; set; }

    [ForeignKey("PersonaId")]
    public virtual Persona Persona { get; set; } = null!;

    [Column("cargo_id")]
    [Required]
    public long CargoId { get; set; }

    [ForeignKey("CargoId")]
    public virtual CargoColaborador? Cargo { get; set; }

    [Required]
    [MaxLength(50)]
    [Column("tipo_colaborador")]
    public string TipoColaborador { get; set; } = string.Empty;

    [Column("fecha_ingreso")]
    public DateOnly FechaIngreso { get; set; } = DateOnly.FromDateTime(DateTime.Today);

    [Column("horario_entrada")]
    public TimeSpan? HorarioEntrada { get; set; }

    [Column("horario_salida")]
    public TimeSpan? HorarioSalida { get; set; }

    [Column("activo")]
    public bool Activo { get; set; } = true;

    [Column("creado_en")]
    public DateTime CreadoEn { get; set; } = DateTime.UtcNow;

    [Column("actualizado_en")]
    public DateTime ActualizadoEn { get; set; } = DateTime.UtcNow;

    public virtual ICollection<AsistenciaColaborador> Asistencias { get; set; } = new List<AsistenciaColaborador>();
}
