summaryrefslogtreecommitdiff
path: root/lib/general-contracts/types.ts
blob: 6793d76c786ccbf29ab36e712c2f79e944a82793 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// 일반계약 관련 타입 정의

// 1. 계약구분
export const GENERAL_CONTRACT_CATEGORIES = [
  'unit_price', // 단가계약
  'general', // 일반계약
  'sale' // 매각계약
] as const;

export type GeneralContractCategory = typeof GENERAL_CONTRACT_CATEGORIES[number];

// 2. 계약종류
export const GENERAL_CONTRACT_TYPES = [
  'UP',   // 자재단가계약
  'LE',   // 임대차계약
  'IL',   // 개별운송계약
  'AL',   // 연간운송계약
  'OS',   // 외주용역계약
  'OW',   // 도급계약
  'LO',   // LOI (의향서)
  'FA',   // FA (Frame Agreement)
  'SC',   // 납품합의계약 (Supply Contract)
  'OF',   // 클레임상계계약 (Offset Agreement)
  'AW',   // 사전작업합의 (Advanced Work)
  'AD',   // 사전납품합의 (Advanced Delivery)
  'SG',   // 임치(물품보관)계약
  'SR',   // 폐기물매각계약 (Scrap)
  'SP'    // S-PEpC
] as const;

export type GeneralContractType = typeof GENERAL_CONTRACT_TYPES[number];

// 3. 계약상태
export const GENERAL_CONTRACT_STATUSES = [
  'Draft', // 임시 저장
  'Request to Review', // 조건검토요청
  'Vendor Replied Review', // 협력업체 회신
  'SHI Confirmed Review', // 당사 검토 확정
  'Contract Accept Request', // 계약승인요청
  'Complete the Contract', // 계약체결(승인)
  'Reject to Accept Contract', // 계약승인거절
  'Contract Delete', // 계약폐기
  'PCR Request', // PCR요청
  'VO Request', // VO 요청
  'PCR Accept', // PCR승인
  'PCR Reject' // PCR거절
] as const;

export type GeneralContractStatus = typeof GENERAL_CONTRACT_STATUSES[number];

// 4. 체결방식
export const GENERAL_EXECUTION_METHODS = [
  '전자계약', 
  '오프라인계약'
] as const;

export type GeneralExecutionMethod = typeof GENERAL_EXECUTION_METHODS[number];

// 6. 계약확정범위
export const GENERAL_CONTRACT_SCOPES = [
  '단가', 
  '금액', 
  '물량', 
  '기타'
] as const;

export type GeneralContractScope = typeof GENERAL_CONTRACT_SCOPES[number];

// 7. 납기종류
export const GENERAL_DELIVERY_TYPES = [
  '단일납기', 
  '분할납기', 
  '구간납기'
] as const;

export type GeneralDeliveryType = typeof GENERAL_DELIVERY_TYPES[number];

// 8. 연동제 적용 여부
export const GENERAL_LINKAGE_TYPES = [
  'Y', 
  'N'
] as const;

export type GeneralLinkageType = typeof GENERAL_LINKAGE_TYPES[number];

// 9. 하도급법 점검결과
export const GENERAL_COMPLIANCE_RESULTS = [
  '준수', 
  '위반', 
  '위반의심'
] as const;

export type GeneralComplianceResult = typeof GENERAL_COMPLIANCE_RESULTS[number];

// 타입 가드 함수들
export const isGeneralContractCategory = (value: string): value is GeneralContractCategory => {
  return GENERAL_CONTRACT_CATEGORIES.includes(value as GeneralContractCategory);
};

export const isGeneralContractType = (value: string): value is GeneralContractType => {
  return GENERAL_CONTRACT_TYPES.includes(value as GeneralContractType);
};

export const isGeneralContractStatus = (value: string): value is GeneralContractStatus => {
  return GENERAL_CONTRACT_STATUSES.includes(value as GeneralContractStatus);
};

export const isGeneralExecutionMethod = (value: string): value is GeneralExecutionMethod => {
  return GENERAL_EXECUTION_METHODS.includes(value as GeneralExecutionMethod);
};

export const isGeneralContractScope = (value: string): value is GeneralContractScope => {
  return GENERAL_CONTRACT_SCOPES.includes(value as GeneralContractScope);
};

export const isGeneralDeliveryType = (value: string): value is GeneralDeliveryType => {
  return GENERAL_DELIVERY_TYPES.includes(value as GeneralDeliveryType);
};

export const isGeneralLinkageType = (value: string): value is GeneralLinkageType => {
  return GENERAL_LINKAGE_TYPES.includes(value as GeneralLinkageType);
};

export const isGeneralComplianceResult = (value: string): value is GeneralComplianceResult => {
  return GENERAL_COMPLIANCE_RESULTS.includes(value as GeneralComplianceResult);
};