#nullable enable
using System;
namespace UVC.UIToolkit
{
///
/// 날짜 범위 속성 데이터 클래스입니다.
/// UI는 UTKDateRangePropertyItemView에서 담당합니다.
///
public class UTKDateRangePropertyItem : UTKPropertyItemBase
{
#region Fields
private string _dateFormat = "yyyy-MM-dd";
#endregion
#region Properties
/// 속성 타입
public override UTKPropertyType PropertyType => UTKPropertyType.DateRange;
/// 날짜 표시 형식
public string DateFormat
{
get => _dateFormat;
set => _dateFormat = value ?? "yyyy-MM-dd";
}
#endregion
#region Constructor
///
/// 날짜 범위 속성을 생성합니다.
///
/// 고유 ID
/// 표시 이름
/// 초기 범위 값
/// 읽기 전용 여부
public UTKDateRangePropertyItem(string id, string name, UTKDateRange initialValue = default, bool isReadOnly = false)
: base(id, name, initialValue.Start == default ? new UTKDateRange(DateTime.Today, DateTime.Today) : initialValue)
{
IsReadOnly = isReadOnly;
}
///
/// 날짜 범위 속성을 생성합니다.
///
/// 고유 ID
/// 표시 이름
/// 시작 날짜
/// 종료 날짜
/// 읽기 전용 여부
public UTKDateRangePropertyItem(string id, string name, DateTime start, DateTime end, bool isReadOnly = false)
: base(id, name, new UTKDateRange(start, end))
{
IsReadOnly = isReadOnly;
}
#endregion
}
}