Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add IsKnown method to enums #135

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ const (
IntrospectionClientTypeSandbox IntrospectionClientType = "sandbox"
)

func (r IntrospectionClientType) IsKnown() bool {
switch r {
case IntrospectionClientTypeProduction, IntrospectionClientTypeDevelopment, IntrospectionClientTypeSandbox:
return true
}
return false
}

// The type of the connection associated with the token.
//
// `provider` - connection to an external provider
Expand All @@ -186,3 +194,11 @@ const (
IntrospectionConnectionTypeProvider IntrospectionConnectionType = "provider"
IntrospectionConnectionTypeFinch IntrospectionConnectionType = "finch"
)

func (r IntrospectionConnectionType) IsKnown() bool {
switch r {
case IntrospectionConnectionTypeProvider, IntrospectionConnectionTypeFinch:
return true
}
return false
}
8 changes: 8 additions & 0 deletions hris.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ const (
IncomeUnitFixed IncomeUnit = "fixed"
)

func (r IncomeUnit) IsKnown() bool {
switch r {
case IncomeUnitYearly, IncomeUnitQuarterly, IncomeUnitMonthly, IncomeUnitSemiMonthly, IncomeUnitBiWeekly, IncomeUnitWeekly, IncomeUnitDaily, IncomeUnitHourly, IncomeUnitFixed:
return true
}
return false
}

// The employee's income as reported by the provider. This may not always be
// annualized income, but may be in units of bi-weekly, semi-monthly, daily, etc,
// depending on what information the provider returns.
Expand Down
72 changes: 72 additions & 0 deletions hrisbenefit.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ const (
BenefitContributionTypePercent BenefitContributionType = "percent"
)

func (r BenefitContributionType) IsKnown() bool {
switch r {
case BenefitContributionTypeFixed, BenefitContributionTypePercent:
return true
}
return false
}

type BenefitFeaturesAndOperations struct {
SupportedFeatures BenefitFeaturesAndOperationsSupportedFeatures `json:"supported_features"`
SupportedOperations SupportPerBenefitType `json:"supported_operations"`
Expand Down Expand Up @@ -210,20 +218,44 @@ const (
BenefitFeaturesAndOperationsSupportedFeaturesCompanyContributionPercent BenefitFeaturesAndOperationsSupportedFeaturesCompanyContribution = "percent"
)

func (r BenefitFeaturesAndOperationsSupportedFeaturesCompanyContribution) IsKnown() bool {
switch r {
case BenefitFeaturesAndOperationsSupportedFeaturesCompanyContributionFixed, BenefitFeaturesAndOperationsSupportedFeaturesCompanyContributionPercent:
return true
}
return false
}

type BenefitFeaturesAndOperationsSupportedFeaturesEmployeeDeduction string

const (
BenefitFeaturesAndOperationsSupportedFeaturesEmployeeDeductionFixed BenefitFeaturesAndOperationsSupportedFeaturesEmployeeDeduction = "fixed"
BenefitFeaturesAndOperationsSupportedFeaturesEmployeeDeductionPercent BenefitFeaturesAndOperationsSupportedFeaturesEmployeeDeduction = "percent"
)

func (r BenefitFeaturesAndOperationsSupportedFeaturesEmployeeDeduction) IsKnown() bool {
switch r {
case BenefitFeaturesAndOperationsSupportedFeaturesEmployeeDeductionFixed, BenefitFeaturesAndOperationsSupportedFeaturesEmployeeDeductionPercent:
return true
}
return false
}

type BenefitFeaturesAndOperationsSupportedFeaturesHsaContributionLimit string

const (
BenefitFeaturesAndOperationsSupportedFeaturesHsaContributionLimitIndividual BenefitFeaturesAndOperationsSupportedFeaturesHsaContributionLimit = "individual"
BenefitFeaturesAndOperationsSupportedFeaturesHsaContributionLimitFamily BenefitFeaturesAndOperationsSupportedFeaturesHsaContributionLimit = "family"
)

func (r BenefitFeaturesAndOperationsSupportedFeaturesHsaContributionLimit) IsKnown() bool {
switch r {
case BenefitFeaturesAndOperationsSupportedFeaturesHsaContributionLimitIndividual, BenefitFeaturesAndOperationsSupportedFeaturesHsaContributionLimitFamily:
return true
}
return false
}

type BenefitFrequency string

const (
Expand All @@ -232,6 +264,14 @@ const (
BenefitFrequencyMonthly BenefitFrequency = "monthly"
)

func (r BenefitFrequency) IsKnown() bool {
switch r {
case BenefitFrequencyOneTime, BenefitFrequencyEveryPaycheck, BenefitFrequencyMonthly:
return true
}
return false
}

// Type of benefit.
type BenefitType string

Expand All @@ -257,6 +297,14 @@ const (
BenefitTypeCustomPreTax BenefitType = "custom_pre_tax"
)

func (r BenefitType) IsKnown() bool {
switch r {
case BenefitType_401k, BenefitType_401kRoth, BenefitType_401kLoan, BenefitType_403b, BenefitType_403bRoth, BenefitType_457, BenefitType_457Roth, BenefitTypeS125Medical, BenefitTypeS125Dental, BenefitTypeS125Vision, BenefitTypeHsaPre, BenefitTypeHsaPost, BenefitTypeFsaMedical, BenefitTypeFsaDependentCare, BenefitTypeSimpleIRA, BenefitTypeSimple, BenefitTypeCommuter, BenefitTypeCustomPostTax, BenefitTypeCustomPreTax:
return true
}
return false
}

// Each benefit type and their supported features. If the benefit type is not
// supported, the property will be null
type BenefitsSupport struct {
Expand Down Expand Up @@ -430,20 +478,44 @@ const (
SupportedBenefitCompanyContributionPercent SupportedBenefitCompanyContribution = "percent"
)

func (r SupportedBenefitCompanyContribution) IsKnown() bool {
switch r {
case SupportedBenefitCompanyContributionFixed, SupportedBenefitCompanyContributionPercent:
return true
}
return false
}

type SupportedBenefitEmployeeDeduction string

const (
SupportedBenefitEmployeeDeductionFixed SupportedBenefitEmployeeDeduction = "fixed"
SupportedBenefitEmployeeDeductionPercent SupportedBenefitEmployeeDeduction = "percent"
)

func (r SupportedBenefitEmployeeDeduction) IsKnown() bool {
switch r {
case SupportedBenefitEmployeeDeductionFixed, SupportedBenefitEmployeeDeductionPercent:
return true
}
return false
}

type SupportedBenefitHsaContributionLimit string

const (
SupportedBenefitHsaContributionLimitIndividual SupportedBenefitHsaContributionLimit = "individual"
SupportedBenefitHsaContributionLimitFamily SupportedBenefitHsaContributionLimit = "family"
)

func (r SupportedBenefitHsaContributionLimit) IsKnown() bool {
switch r {
case SupportedBenefitHsaContributionLimitIndividual, SupportedBenefitHsaContributionLimitFamily:
return true
}
return false
}

type UpdateCompanyBenefitResponse struct {
BenefitID string `json:"benefit_id,required"`
JSON updateCompanyBenefitResponseJSON `json:"-"`
Expand Down
8 changes: 8 additions & 0 deletions hrisbenefitindividual.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ const (
IndividualBenefitBodyHsaContributionLimitFamily IndividualBenefitBodyHsaContributionLimit = "family"
)

func (r IndividualBenefitBodyHsaContributionLimit) IsKnown() bool {
switch r {
case IndividualBenefitBodyHsaContributionLimitIndividual, IndividualBenefitBodyHsaContributionLimitFamily:
return true
}
return false
}

type UnenrolledIndividual struct {
Body UnenrolledIndividualBody `json:"body"`
// HTTP status code
Expand Down
24 changes: 24 additions & 0 deletions hriscompany.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ const (
CompanyAccountsAccountTypeSavings CompanyAccountsAccountType = "savings"
)

func (r CompanyAccountsAccountType) IsKnown() bool {
switch r {
case CompanyAccountsAccountTypeChecking, CompanyAccountsAccountTypeSavings:
return true
}
return false
}

type CompanyDepartment struct {
// The department name.
Name string `json:"name,nullable"`
Expand Down Expand Up @@ -204,6 +212,14 @@ const (
CompanyEntitySubtypeBCorporation CompanyEntitySubtype = "b_corporation"
)

func (r CompanyEntitySubtype) IsKnown() bool {
switch r {
case CompanyEntitySubtypeSCorporation, CompanyEntitySubtypeCCorporation, CompanyEntitySubtypeBCorporation:
return true
}
return false
}

// The tax payer type of the company.
type CompanyEntityType string

Expand All @@ -216,3 +232,11 @@ const (
CompanyEntityTypePartnership CompanyEntityType = "partnership"
CompanyEntityTypeCooperative CompanyEntityType = "cooperative"
)

func (r CompanyEntityType) IsKnown() bool {
switch r {
case CompanyEntityTypeLlc, CompanyEntityTypeLp, CompanyEntityTypeCorporation, CompanyEntityTypeSoleProprietor, CompanyEntityTypeNonProfit, CompanyEntityTypePartnership, CompanyEntityTypeCooperative:
return true
}
return false
}
16 changes: 16 additions & 0 deletions hrisemployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@ const (
EmploymentDataEmploymentSubtypeIndividualContractor EmploymentDataEmploymentSubtype = "individual_contractor"
)

func (r EmploymentDataEmploymentSubtype) IsKnown() bool {
switch r {
case EmploymentDataEmploymentSubtypeFullTime, EmploymentDataEmploymentSubtypeIntern, EmploymentDataEmploymentSubtypePartTime, EmploymentDataEmploymentSubtypeTemp, EmploymentDataEmploymentSubtypeSeasonal, EmploymentDataEmploymentSubtypeIndividualContractor:
return true
}
return false
}

// The main employment type of the individual.
type EmploymentDataEmploymentType string

Expand All @@ -217,6 +225,14 @@ const (
EmploymentDataEmploymentTypeContractor EmploymentDataEmploymentType = "contractor"
)

func (r EmploymentDataEmploymentType) IsKnown() bool {
switch r {
case EmploymentDataEmploymentTypeEmployee, EmploymentDataEmploymentTypeContractor:
return true
}
return false
}

// The manager object representing the manager of the individual within the org.
type EmploymentDataManager struct {
// A stable Finch `id` (UUID v4) for an individual in the company.
Expand Down
32 changes: 32 additions & 0 deletions hrisindividual.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ const (
IndividualEmailsTypePersonal IndividualEmailsType = "personal"
)

func (r IndividualEmailsType) IsKnown() bool {
switch r {
case IndividualEmailsTypeWork, IndividualEmailsTypePersonal:
return true
}
return false
}

// The EEOC-defined ethnicity of the individual.
type IndividualEthnicity string

Expand All @@ -153,6 +161,14 @@ const (
IndividualEthnicityDeclineToSpecify IndividualEthnicity = "decline_to_specify"
)

func (r IndividualEthnicity) IsKnown() bool {
switch r {
case IndividualEthnicityAsian, IndividualEthnicityWhite, IndividualEthnicityBlackOrAfricanAmerican, IndividualEthnicityNativeHawaiianOrPacificIslander, IndividualEthnicityAmericanIndianOrAlaskaNative, IndividualEthnicityHispanicOrLatino, IndividualEthnicityTwoOrMoreRaces, IndividualEthnicityDeclineToSpecify:
return true
}
return false
}

// The gender of the individual.
type IndividualGender string

Expand All @@ -163,6 +179,14 @@ const (
IndividualGenderDeclineToSpecify IndividualGender = "decline_to_specify"
)

func (r IndividualGender) IsKnown() bool {
switch r {
case IndividualGenderFemale, IndividualGenderMale, IndividualGenderOther, IndividualGenderDeclineToSpecify:
return true
}
return false
}

type IndividualPhoneNumber struct {
Data string `json:"data,nullable"`
Type IndividualPhoneNumbersType `json:"type,nullable"`
Expand Down Expand Up @@ -193,6 +217,14 @@ const (
IndividualPhoneNumbersTypePersonal IndividualPhoneNumbersType = "personal"
)

func (r IndividualPhoneNumbersType) IsKnown() bool {
switch r {
case IndividualPhoneNumbersTypeWork, IndividualPhoneNumbersTypePersonal:
return true
}
return false
}

type IndividualResponse struct {
Body Individual `json:"body"`
Code int64 `json:"code"`
Expand Down
32 changes: 32 additions & 0 deletions hrispaystatement.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ const (
PayStatementEarningsTypeOther PayStatementEarningsType = "other"
)

func (r PayStatementEarningsType) IsKnown() bool {
switch r {
case PayStatementEarningsTypeSalary, PayStatementEarningsTypeWage, PayStatementEarningsTypeReimbursement, PayStatementEarningsTypeOvertime, PayStatementEarningsTypeSeverance, PayStatementEarningsTypeDoubleOvertime, PayStatementEarningsTypePto, PayStatementEarningsTypeSick, PayStatementEarningsTypeBonus, PayStatementEarningsTypeCommission, PayStatementEarningsTypeTips, PayStatementEarningsType1099, PayStatementEarningsTypeOther:
return true
}
return false
}

type PayStatementEmployeeDeduction struct {
// The deduction amount in cents.
Amount int64 `json:"amount,nullable"`
Expand Down Expand Up @@ -232,6 +240,14 @@ const (
PayStatementPaymentMethodDirectDeposit PayStatementPaymentMethod = "direct_deposit"
)

func (r PayStatementPaymentMethod) IsKnown() bool {
switch r {
case PayStatementPaymentMethodCheck, PayStatementPaymentMethodDirectDeposit:
return true
}
return false
}

type PayStatementTax struct {
// The tax amount in cents.
Amount int64 `json:"amount,nullable"`
Expand Down Expand Up @@ -275,6 +291,14 @@ const (
PayStatementTaxesTypeFica PayStatementTaxesType = "fica"
)

func (r PayStatementTaxesType) IsKnown() bool {
switch r {
case PayStatementTaxesTypeState, PayStatementTaxesTypeFederal, PayStatementTaxesTypeLocal, PayStatementTaxesTypeFica:
return true
}
return false
}

// The type of the payment associated with the pay statement.
type PayStatementType string

Expand All @@ -284,6 +308,14 @@ const (
PayStatementTypeOneTimePayment PayStatementType = "one_time_payment"
)

func (r PayStatementType) IsKnown() bool {
switch r {
case PayStatementTypeRegularPayroll, PayStatementTypeOffCyclePayroll, PayStatementTypeOneTimePayment:
return true
}
return false
}

type PayStatementResponse struct {
Body PayStatementResponseBody `json:"body"`
Code int64 `json:"code"`
Expand Down
Loading