Coverage for arbejdstimer/api_auto_derive.py: 0.00%

28 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-07-09 12:48 +0200

1# generated by datamodel-codegen: 

2# filename: arbejdstimer-configuration-schema.json 

3# timestamp: 2021-12-29T17:22:42+00:00 

4 

5from __future__ import annotations 

6 

7from datetime import date 

8from enum import Enum 

9from typing import Annotated, List, Optional 

10 

11from pydantic import BaseModel, Field 

12 

13 

14class Application(Enum): 

15 arbejdstimer = 'arbejdstimer' 

16 

17 

18class Operator(Enum): 

19 and_ = 'and' 

20 or_ = 'or' 

21 xor = 'xor' 

22 

23 

24class WorkingHoursTypeItem(BaseModel): 

25 __root__: Annotated[int, Field(ge=0.0, le=23.0)] 

26 

27 

28class WorkingHoursType(BaseModel): 

29 __root__: Annotated[ 

30 List[WorkingHoursTypeItem], 

31 Field( 

32 description='Inclusive range of 24 hour start and end integer values.', 

33 max_items=2, 

34 min_items=2, 

35 title='Working Hours', 

36 ), 

37 ] 

38 

39 

40class Dates(BaseModel): 

41 __root__: Annotated[ 

42 List[date], 

43 Field( 

44 description='Two dates are an inclusive range and 1, 3, or more dates represent a set of dates.', 

45 min_items=1, 

46 title='Dates - Range or Set', 

47 ), 

48 ] 

49 

50 

51class HolidaysTypeItem(BaseModel): 

52 label: Annotated[Optional[str], Field(examples=['public holiday'])] = '' 

53 at: Dates 

54 

55 

56class HolidaysType(BaseModel): 

57 __root__: Annotated[ 

58 List[HolidaysTypeItem], 

59 Field( 

60 description='Optionally labeled dates of non-working days.', 

61 min_items=0, 

62 title='Holidays', 

63 ), 

64 ] 

65 

66 

67class Arbejdstimer(BaseModel): 

68 api: Annotated[ 

69 Optional[int], 

70 Field( 

71 description='API version of the application this configuration targets.', 

72 title='API Version', 

73 ), 

74 ] = 1 

75 application: Annotated[ 

76 Optional[Application], 

77 Field( 

78 description='Name of the application this configuration targets.', 

79 title='Application Name', 

80 ), 

81 ] = 'arbejdstimer' # type: ignore 

82 operator: Annotated[ 

83 Operator, 

84 Field( 

85 description='Logic combining the given specific values with the application defaults.', 

86 title='Logic for Combination with Default Values', 

87 ), 

88 ] 

89 holidays: Optional[HolidaysType] = None 

90 working_hours: Optional[WorkingHoursType] = None