namespace OpcUaManager.Models; // ── 인증서 관련 ──────────────────────────────────────────────── /// 프론트엔드에서 전달받는 인증서 생성 요청 public class CertCreateRequest { /// 내 컴퓨터(클라이언트) 호스트명 e.g. "dbsvr" public string ClientHostName { get; set; } = string.Empty; /// OPC Application 이름 e.g. "OpcTestClient" public string ApplicationName { get; set; } = string.Empty; /// 상대 OPC 서버 호스트명 (SAN DNS) e.g. "opc-server-01" public string ServerHostName { get; set; } = string.Empty; /// 상대 OPC 서버 IP (SAN IP) e.g. "192.168.0.20" public string ServerIp { get; set; } = string.Empty; /// PFX 비밀번호 (없으면 빈 문자열) public string PfxPassword { get; set; } = string.Empty; /// 인증서 유효 기간(일) public int ValidDays { get; set; } = 365; } /// 인증서 생성 결과 public class CertCreateResult { public bool Success { get; set; } public string Message { get; set; } = string.Empty; /// 생성된 PFX 파일의 서버 내 절대 경로 public string PfxPath { get; set; } = string.Empty; /// 적용된 Application URI public string ApplicationUri { get; set; } = string.Empty; /// 썸프린트(SHA-1 hex) public string Thumbprint { get; set; } = string.Empty; public string SerialNumber { get; set; } = string.Empty; public string NotBefore { get; set; } = string.Empty; public string NotAfter { get; set; } = string.Empty; } // ── OPC 세션 관련 ──────────────────────────────────────────── public class ConnectRequest { public string ServerIp { get; set; } = string.Empty; public int Port { get; set; } = 4840; public string UserName { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; public string SecurityPolicy { get; set; } = "Basic256Sha256"; public int SessionTimeoutMs { get; set; } = 60000; /// 사용할 PFX 경로 (cert 생성 후 전달) public string PfxPath { get; set; } = string.Empty; public string PfxPassword { get; set; } = string.Empty; public string ApplicationName { get; set; } = "OpcTestClient"; public string ApplicationUri { get; set; } = string.Empty; } public class ConnectResult { public bool Success { get; set; } public string Message { get; set; } = string.Empty; public string SessionId { get; set; } = string.Empty; public string EndpointUrl { get; set; } = string.Empty; public string SecurityMode { get; set; } = string.Empty; } // ── Crawler 관련 ───────────────────────────────────────────── public class CrawlRequest { public string StartNodeId { get; set; } = "ns=1;s=$assetmodel"; public int MaxDepth { get; set; } = 5; } public class TagMaster { public string TagName { get; set; } = string.Empty; public string FullNodeId { get; set; } = string.Empty; public string NodeClass { get; set; } = string.Empty; public string DataType { get; set; } = string.Empty; public int Level { get; set; } } public class CrawlResult { public bool Success { get; set; } public string Message { get; set; } = string.Empty; public int TotalNodes { get; set; } public List Tags { get; set; } = []; public string CsvPath { get; set; } = string.Empty; } // ── Database 관련 ───────────────────────────────────────────── public class DbWriteRequest { /// 읽을 OPC 태그 Node ID public string TagNodeId { get; set; } = string.Empty; /// DB에 저장할 태그 이름 public string TagName { get; set; } = string.Empty; /// 반복 횟수 public int Count { get; set; } = 5; /// 읽기 간격 (ms) public int IntervalMs { get; set; } = 2000; // DB 접속 정보 public string DbHost { get; set; } = "localhost"; public string DbName { get; set; } = "opcdb"; public string DbUser { get; set; } = "postgres"; public string DbPassword { get; set; } = "postgres"; } public class DbWriteRecord { public int Seq { get; set; } public DateTime Timestamp { get; set; } public string TagName { get; set; } = string.Empty; public double Value { get; set; } public string StatusCode { get; set; } = string.Empty; public bool DbSaved { get; set; } } public class DbWriteResult { public bool Success { get; set; } public string Message { get; set; } = string.Empty; public int SavedCount { get; set; } public List Records { get; set; } = []; } public class DbQueryResult { public bool Success { get; set; } public string Message { get; set; } = string.Empty; public int TotalCount { get; set; } public List Rows { get; set; } = []; } public class OpcHistoryRow { public long Id { get; set; } public string TagName { get; set; } = string.Empty; public double TagValue { get; set; } public string StatusCode { get; set; } = string.Empty; public DateTime CreatedAt { get; set; } } // ── 공통 ───────────────────────────────────────────────────── public class StatusCodeInfo { public string Name { get; set; } = string.Empty; public string Hex { get; set; } = string.Empty; public ulong Decimal { get; set; } public string Description { get; set; } = string.Empty; } public class ApiError { public string Error { get; set; } = string.Empty; public string Detail { get; set; } = string.Empty; }